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/session.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/session.c')
-rw-r--r-- | usr.sbin/bgpd/session.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 6efc3ad2643..52e546334e9 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.54 2004/01/01 23:46:47 henning Exp $ */ +/* $OpenBSD: session.c,v 1.55 2004/01/03 14:06:35 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -1270,9 +1270,12 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx) enum reconf_action reconf; int n; - if (imsg_read(ibuf) == -1) + if ((n = imsg_read(ibuf)) == -1) fatal("session_dispatch_imsg: imsg_read error"); + if (n == 0) /* connection closed */ + fatal("session_dispatch_imsg: pipe closed"); + for (;;) { if ((n = imsg_get(ibuf, &imsg)) == -1) fatal("session_dispatch_imsg: imsg_get error"); |