summaryrefslogtreecommitdiff
path: root/usr.sbin/ypldap/ypldap_dns.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2014-07-13 12:08:00 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2014-07-13 12:08:00 +0000
commitf1b98cae21f0f62799fbbc23fee97381c77bda62 (patch)
tree76c0d1f12ba252aa2d7d35e563b4d8887ed38bd8 /usr.sbin/ypldap/ypldap_dns.c
parentc8394eebdedf4c4216a1b55c1b7b59ab8cbc8b52 (diff)
Close connection/remove event handler when msgbuf_write() hits an
EOF. ok jmatthew@ claudio@
Diffstat (limited to 'usr.sbin/ypldap/ypldap_dns.c')
-rw-r--r--usr.sbin/ypldap/ypldap_dns.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/ypldap/ypldap_dns.c b/usr.sbin/ypldap/ypldap_dns.c
index 06e13f9f11b..677b03aa042 100644
--- a/usr.sbin/ypldap/ypldap_dns.c
+++ b/usr.sbin/ypldap/ypldap_dns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypldap_dns.c,v 1.5 2012/03/16 01:57:42 jmatthew Exp $ */
+/* $OpenBSD: ypldap_dns.c,v 1.6 2014/07/13 12:07:59 krw Exp $ */
/*
* Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org>
@@ -142,10 +142,11 @@ dns_dispatch_imsg(int fd, short event, void *p)
shut = 1;
break;
case EV_WRITE:
- if (msgbuf_write(&ibuf->w) == -1)
+ if ((n = msgbuf_write(&ibuf->w)) == -1 && errno != EAGAIN)
fatal("msgbuf_write");
- imsg_event_add(iev);
- return;
+ if (n == 0)
+ shut = 1;
+ goto done;
default:
fatalx("unknown event");
}
@@ -189,6 +190,8 @@ dns_dispatch_imsg(int fd, short event, void *p)
}
imsg_free(&imsg);
}
+
+done:
if (!shut)
imsg_event_add(iev);
else {