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/imsg.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'usr.sbin/bgpd/imsg.c') 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 @@ -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 -- cgit v1.2.3