diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-11-21 13:16:08 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-11-21 13:16:08 +0000 |
commit | 9c8d00dd06d79ba9fccf07c45cd1bdae73e744c5 (patch) | |
tree | 9dbbc9d2f725d8ee1474850be3abaff593b88fe4 /usr.sbin/ypldap/ldapclient.c | |
parent | 2e2a93ef22aa29ad33b76ca24ca1ffc708c7d123 (diff) |
Convert imsg_write() callers to the new simplified return logic.
OK tb@
Diffstat (limited to 'usr.sbin/ypldap/ldapclient.c')
-rw-r--r-- | usr.sbin/ypldap/ldapclient.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.sbin/ypldap/ldapclient.c b/usr.sbin/ypldap/ldapclient.c index 0b4ac02f84a..dc8c1b172d9 100644 --- a/usr.sbin/ypldap/ldapclient.c +++ b/usr.sbin/ypldap/ldapclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapclient.c,v 1.51 2024/11/21 13:10:57 claudio Exp $ */ +/* $OpenBSD: ldapclient.c,v 1.52 2024/11/21 13:16:07 claudio Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org> @@ -147,11 +147,12 @@ client_dispatch_dns(int fd, short events, void *p) shut = 1; } if (events & EV_WRITE) { - if ((n = imsg_write(ibuf)) == -1 && errno != EAGAIN) - fatal("imsg_write"); - if (n == 0) - shut = 1; - goto done; + if (imsg_write(ibuf) == -1) { + if (errno == EPIPE) /* connection closed */ + shut = 1; + else + fatal("imsg_write"); + } } for (;;) { @@ -217,7 +218,6 @@ client_dispatch_dns(int fd, short events, void *p) imsg_compose_event(env->sc_iev, IMSG_END_UPDATE, 0, 0, -1, NULL, 0); -done: if (!shut) imsg_event_add(iev); else { @@ -247,11 +247,12 @@ client_dispatch_parent(int fd, short events, void *p) shut = 1; } if (events & EV_WRITE) { - if ((n = imsg_write(ibuf)) == -1 && errno != EAGAIN) - fatal("imsg_write"); - if (n == 0) - shut = 1; - goto done; + if (imsg_write(ibuf) == -1) { + if (errno == EPIPE) /* connection closed */ + shut = 1; + else + fatal("imsg_write"); + } } for (;;) { @@ -303,7 +304,6 @@ client_dispatch_parent(int fd, short events, void *p) imsg_free(&imsg); } -done: if (!shut) imsg_event_add(iev); else { |