diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-03 14:06:36 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-03 14:06:36 +0000 |
commit | 9a036d216a1cf77b21b0610eeff34251279dbafa (patch) | |
tree | f5f90f063bfb98fd964ce485e6b57238e9507266 /usr.sbin/bgpd/imsg.c | |
parent | 6f7ff937aa150621fcaa178405ebd86a0a33bda6 (diff) |
change imsg_read semantics so that the number of bytes read is returned.
that means that the callers can (and must) coope with closed connections
themselves, what is exactly the desired behaviour.
Diffstat (limited to 'usr.sbin/bgpd/imsg.c')
-rw-r--r-- | usr.sbin/bgpd/imsg.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/imsg.c b/usr.sbin/bgpd/imsg.c index 1d2a8d4abab..a008c5dd00e 100644 --- a/usr.sbin/bgpd/imsg.c +++ b/usr.sbin/bgpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.17 2004/01/01 23:46:47 henning Exp $ */ +/* $OpenBSD: imsg.c,v 1.18 2004/01/03 14:06:35 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -42,19 +42,15 @@ imsg_read(struct imsgbuf *ibuf) if ((n = read(ibuf->sock, ibuf->r.buf + ibuf->r.wpos, sizeof(ibuf->r.buf) - ibuf->r.wpos)) == -1) { if (errno != EINTR && errno != EAGAIN) { - log_err("imsg_get: pipe read error"); + log_err("imsg_read: pipe read error"); return (-1); } return (0); } - if (n == 0) { /* connection closed */ - logit(LOG_CRIT, "imsg_get: pipe closed"); - return (-1); - } ibuf->r.wpos += n; - return (0); + return (n); } int |