diff options
Diffstat (limited to 'usr.sbin/ldpd/ldpe.c')
-rw-r--r-- | usr.sbin/ldpd/ldpe.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/usr.sbin/ldpd/ldpe.c b/usr.sbin/ldpd/ldpe.c index 1ebceba57c2..be154d0bb83 100644 --- a/usr.sbin/ldpd/ldpe.c +++ b/usr.sbin/ldpd/ldpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpe.c,v 1.83 2024/11/21 13:10:39 claudio Exp $ */ +/* $OpenBSD: ldpe.c,v 1.84 2024/11/21 13:16:07 claudio Exp $ */ /* * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org> @@ -237,10 +237,12 @@ ldpe_dispatch_main(int fd, short event, void *bula) shut = 1; } if (event & EV_WRITE) { - if ((n = imsg_write(ibuf)) == -1 && errno != EAGAIN) - fatal("ldpe_dispatch_main: imsg_write"); - if (n == 0) - shut = 1; + if (imsg_write(ibuf) == -1) { + if (errno == EPIPE) /* connection closed */ + shut = 1; + else + fatal("imsg_write"); + } } for (;;) { @@ -501,10 +503,12 @@ ldpe_dispatch_lde(int fd, short event, void *bula) shut = 1; } if (event & EV_WRITE) { - if ((n = imsg_write(ibuf)) == -1 && errno != EAGAIN) - fatal("ldpe_dispatch_lde: imsg_write"); - if (n == 0) - shut = 1; + if (imsg_write(ibuf) == -1) { + if (errno == EPIPE) /* connection closed */ + shut = 1; + else + fatal("imsg_write"); + } } for (;;) { |