summaryrefslogtreecommitdiff
path: root/usr.sbin/rad/engine.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:16:08 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:16:08 +0000
commit9c8d00dd06d79ba9fccf07c45cd1bdae73e744c5 (patch)
tree9dbbc9d2f725d8ee1474850be3abaff593b88fe4 /usr.sbin/rad/engine.c
parent2e2a93ef22aa29ad33b76ca24ca1ffc708c7d123 (diff)
Convert imsg_write() callers to the new simplified return logic.
OK tb@
Diffstat (limited to 'usr.sbin/rad/engine.c')
-rw-r--r--usr.sbin/rad/engine.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/usr.sbin/rad/engine.c b/usr.sbin/rad/engine.c
index 6847401aaea..f2549e78b1d 100644
--- a/usr.sbin/rad/engine.c
+++ b/usr.sbin/rad/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.23 2024/11/21 13:10:47 claudio Exp $ */
+/* $OpenBSD: engine.c,v 1.24 2024/11/21 13:16:07 claudio Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -200,10 +200,12 @@ engine_dispatch_frontend(int fd, short event, void *bula)
shut = 1;
}
if (event & EV_WRITE) {
- if ((n = imsg_write(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_write");
- if (n == 0) /* Connection closed. */
- shut = 1;
+ if (imsg_write(ibuf) == -1) {
+ if (errno == EPIPE) /* connection closed */
+ shut = 1;
+ else
+ fatal("imsg_write");
+ }
}
for (;;) {
@@ -282,10 +284,12 @@ engine_dispatch_main(int fd, short event, void *bula)
shut = 1;
}
if (event & EV_WRITE) {
- if ((n = imsg_write(ibuf)) == -1 && errno != EAGAIN)
- fatal("imsg_write");
- if (n == 0) /* Connection closed. */
- shut = 1;
+ if (imsg_write(ibuf) == -1) {
+ if (errno == EPIPE) /* connection closed */
+ shut = 1;
+ else
+ fatal("imsg_write");
+ }
}
for (;;) {