diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-19 02:20:26 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-19 02:20:26 +0000 |
commit | f5fab07b5ada6eec7f658b405205ea35b1cedf83 (patch) | |
tree | 67f6ab552c12bc35c4ab8e61ce5add6c7f771233 | |
parent | 15b875d2b645610a3a9a7a24dde2aeb83a3bf24f (diff) |
'quit' no longer holds signals, so strsignal(quit) is both pointless
and now in unreachable code. Simplifies dispatch loops by eliminating
most uses of INTERNALSIG.
-rw-r--r-- | sbin/dhclient/dhclient.c | 20 | ||||
-rw-r--r-- | sbin/dhclient/dispatch.c | 19 |
2 files changed, 12 insertions, 27 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 63b578a6635..2a15dd9cc73 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.614 2019/01/19 01:53:08 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.615 2019/01/19 02:20:25 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -2221,25 +2221,20 @@ fork_privchld(struct interface_info *ifi, int fd, int fd2) if (errno == EINTR) continue; log_warn("%s: poll(priv_ibuf)", log_procname); - quit = INTERNALSIG; - continue; - } - if ((pfd[0].revents & (POLLERR | POLLHUP | POLLNVAL)) != 0) { - quit = INTERNALSIG; - continue; + break; } + if ((pfd[0].revents & (POLLERR | POLLHUP | POLLNVAL)) != 0) + break; if (nfds == 0 || (pfd[0].revents & POLLIN) == 0) continue; if ((n = imsg_read(priv_ibuf)) == -1 && errno != EAGAIN) { log_warn("%s: imsg_read(priv_ibuf)", log_procname); - quit = INTERNALSIG; - continue; + break; } if (n == 0) { /* Connection closed - other end should log message. */ - quit = INTERNALSIG; - continue; + break; } dispatch_imsg(ifi->name, ifi->rdomain, ioctlfd, routefd, @@ -2258,9 +2253,6 @@ fork_privchld(struct interface_info *ifi, int fd, int fd2) fatal("execvp(%s)", saved_argv[0]); } - if (quit != INTERNALSIG) - fatalx("%s", strsignal(quit)); - exit(1); } diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index 4248aa85130..c2fe0befce1 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.159 2019/01/18 01:38:58 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.160 2019/01/19 02:20:25 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -146,24 +146,20 @@ dispatch(struct interface_info *ifi, int routefd) continue; log_warn("%s: poll(bpffd, routefd, unpriv_ibuf)", log_procname); - quit = INTERNALSIG; - continue; + break; } if ((fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) != 0) { log_debug("%s: bpffd: ERR|HUP|NVAL", log_procname); - quit = INTERNALSIG; - continue; + break; } if ((fds[1].revents & (POLLERR | POLLHUP | POLLNVAL)) != 0) { log_debug("%s: routefd: ERR|HUP|NVAL", log_procname); - quit = INTERNALSIG; - continue; + break; } if ((fds[2].revents & (POLLERR | POLLHUP | POLLNVAL)) != 0) { log_debug("%s: unpriv_ibuf: ERR|HUP|NVAL", log_procname); - quit = INTERNALSIG; - continue; + break; } if (nfds == 0) @@ -176,11 +172,8 @@ dispatch(struct interface_info *ifi, int routefd) if ((fds[2].revents & POLLOUT) != 0) flush_unpriv_ibuf(); if ((fds[2].revents & POLLIN) != 0) - quit = INTERNALSIG; + break; } - - if (quit != INTERNALSIG && quit != SIGHUP) - fatalx("%s", strsignal(quit)); } void |