diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-07-12 20:16:39 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-07-12 20:16:39 +0000 |
commit | 93f226fdd7fd863d667ca20568296621176a26d3 (patch) | |
tree | 30c7a25aa8da5b4c855e46c9df765fb8e80ed899 /usr.sbin/ospf6d/rde.c | |
parent | 968d9aade2b89c5889776f17a59253ccf5d649e3 (diff) |
Close connections when msgbuf_write() returns 0.
ok claudio@
Diffstat (limited to 'usr.sbin/ospf6d/rde.c')
-rw-r--r-- | usr.sbin/ospf6d/rde.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c index cdd5dc9dae7..b60d263e756 100644 --- a/usr.sbin/ospf6d/rde.c +++ b/usr.sbin/ospf6d/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.61 2013/11/13 20:49:49 benno Exp $ */ +/* $OpenBSD: rde.c,v 1.62 2014/07/12 20:16:38 krw Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -266,8 +266,10 @@ rde_dispatch_imsg(int fd, short event, void *bula) shut = 1; } if (event & EV_WRITE) { - if (msgbuf_write(&ibuf->w) == -1 && errno != EAGAIN) + if ((n = msgbuf_write(&ibuf->w)) == -1 && errno != EAGAIN) fatal("msgbuf_write"); + if (n == 0) /* connection closed */ + shut = 1; } clock_gettime(CLOCK_MONOTONIC, &tp); @@ -638,8 +640,10 @@ rde_dispatch_parent(int fd, short event, void *bula) shut = 1; } if (event & EV_WRITE) { - if (msgbuf_write(&ibuf->w) == -1 && errno != EAGAIN) + if ((n = msgbuf_write(&ibuf->w)) == -1 && errno != EAGAIN) fatal("msgbuf_write"); + if (n == 0) /* connection closed */ + shut = 1; } for (;;) { |