diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-11-04 18:00:08 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-11-04 18:00:08 +0000 |
commit | 0eb2498c45ec0c7d6e220f024d81b1402964692b (patch) | |
tree | 9df1ff1c87a549bdb883bd0e97fc84fef1abdf5f /usr.sbin | |
parent | 4518c9caea0731085f5819e19004d2c376e86e10 (diff) |
On errors related to the pipes to the childs don't error out right away.
Instead exit the main event loop and use waitpid to know why a child
went away. This should make it hopefully more clear when shit hits the fan.
OK tb@ deraadt@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/rpki-client/main.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index c11a28b3122..4ea97df451a 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.162 2021/11/04 14:24:41 claudio Exp $ */ +/* $OpenBSD: main.c,v 1.163 2021/11/04 18:00:07 claudio Exp $ */ /* * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> @@ -1020,19 +1020,23 @@ main(int argc, char *argv[]) } for (i = 0; i < NPFD; i++) { - if (pfd[i].revents & (POLLERR|POLLNVAL)) - errx(1, "poll[%zu]: bad fd", i); - if (pfd[i].revents & POLLHUP) { - warnx("poll[%zu]: hangup", i); + if (pfd[i].revents & (POLLERR|POLLNVAL)) { + warnx("poll[%zu]: bad fd", i); hangup = 1; } + if (pfd[i].revents & POLLHUP) + hangup = 1; if (pfd[i].revents & POLLOUT) { switch (msgbuf_write(queues[i])) { case 0: - errx(1, "write[%zu]: " + warnx("write[%zu]: " "connection closed", i); + hangup = 1; + break; case -1: - err(1, "write[%zu]", i); + warn("write[%zu]", i); + hangup = 1; + break; } } } @@ -1147,7 +1151,7 @@ main(int argc, char *argv[]) /* processing did not finish because of error */ if (entity_queue != 0) - return 1; + errx(1, "not all files processed, giving up"); logx("all files parsed: generating output"); |