summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-03 14:06:36 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-03 14:06:36 +0000
commit9a036d216a1cf77b21b0610eeff34251279dbafa (patch)
treef5f90f063bfb98fd964ce485e6b57238e9507266 /usr.sbin/bgpd/rde.c
parent6f7ff937aa150621fcaa178405ebd86a0a33bda6 (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/rde.c')
-rw-r--r--usr.sbin/bgpd/rde.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 236589583be..7010c8177c5 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.40 2004/01/01 23:09:09 henning Exp $ */
+/* $OpenBSD: rde.c,v 1.41 2004/01/03 14:06:35 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -176,9 +176,12 @@ rde_dispatch_imsg(struct imsgbuf *ibuf, int idx)
u_int32_t rid;
int n;
- if (imsg_read(ibuf) == -1)
+ if ((n = imsg_read(ibuf)) == -1)
fatal("rde_dispatch_imsg: imsg_read error");
+ if (n == 0) /* connection closed */
+ fatal("rde_dispatch_imsg: pipe closed");
+
for (;;) {
if ((n = imsg_get(ibuf, &imsg)) == -1)
fatal("rde_dispatch_imsg: imsg_read error");