From 9a036d216a1cf77b21b0610eeff34251279dbafa Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Sat, 3 Jan 2004 14:06:36 +0000 Subject: 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. --- usr.sbin/bgpd/rde.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'usr.sbin/bgpd/rde.c') 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 @@ -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"); -- cgit v1.2.3