diff options
Diffstat (limited to 'usr.sbin/dvmrpd/dvmrpe.c')
-rw-r--r-- | usr.sbin/dvmrpd/dvmrpe.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/dvmrpd/dvmrpe.c b/usr.sbin/dvmrpd/dvmrpe.c index 0ee578e65b2..76b8cb16ea3 100644 --- a/usr.sbin/dvmrpd/dvmrpe.c +++ b/usr.sbin/dvmrpd/dvmrpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpe.c,v 1.16 2016/09/02 15:33:27 renato Exp $ */ +/* $OpenBSD: dvmrpe.c,v 1.17 2016/09/02 15:35:34 renato Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -249,8 +249,10 @@ dvmrpe_dispatch_main(int fd, short event, void *bula) shut = 1; } if (event & EV_WRITE) { - if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN) + if ((n = msgbuf_write(&ibuf->w)) == -1 && errno != EAGAIN) fatal("msgbuf_write"); + if (n == 0) /* connection closed */ + shut = 1; } for (;;) { @@ -321,8 +323,10 @@ dvmrpe_dispatch_rde(int fd, short event, void *bula) shut = 1; } if (event & EV_WRITE) { - if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN) + if ((n = msgbuf_write(&ibuf->w)) == -1 && errno != EAGAIN) fatal("msgbuf_write"); + if (n == 0) /* connection closed */ + shut = 1; } for (;;) { |