diff options
author | 2017-11-21 19:22:45 +0000 | |
---|---|---|
committer | 2017-11-21 19:22:45 +0000 | |
commit | cf14a1828234be7033d580ff9b0cc737b067675b (patch) | |
tree | 1677cdc8325f89005cfc1165ea5a56553937145f | |
parent | Avoid .align 0. Clang's integrated assembler actually honors this directive (diff) | |
download | wireguard-openbsd-cf14a1828234be7033d580ff9b0cc737b067675b.tar.xz wireguard-openbsd-cf14a1828234be7033d580ff9b0cc737b067675b.zip |
Do not exit 0 if the program was terminated due to receipt of a signal other
than SIGHUP.
-rw-r--r-- | regress/bin/ksh/edit/edit.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/regress/bin/ksh/edit/edit.c b/regress/bin/ksh/edit/edit.c index 62e73a2374a..17bae5c266f 100644 --- a/regress/bin/ksh/edit/edit.c +++ b/regress/bin/ksh/edit/edit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.6 2017/07/22 13:50:54 anton Exp $ */ +/* $OpenBSD: edit.c,v 1.7 2017/11/21 19:22:45 anton Exp $ */ /* * Copyright (c) 2017 Anton Lindqvist <anton@openbsd.org> * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <sys/wait.h> + #include <err.h> #include <errno.h> #include <poll.h> @@ -46,7 +48,7 @@ main(int argc, char *argv[]) pid_t pid; ssize_t n; size_t nin, nprompt, nread, nwrite; - int c, nready, ptyfd, readprompt, ret, timeout; + int c, nready, ptyfd, readprompt, ret, status, timeout; while ((c = getopt(argc, argv, "p:")) != -1) { switch (c) { @@ -142,6 +144,13 @@ main(int argc, char *argv[]) } } close(ptyfd); + while (waitpid(pid, &status, 0) == -1) + if (errno != EINTR) + err(1, "waitpid"); + if (WIFSIGNALED(status) && WTERMSIG(status) != SIGHUP) { + warnx("%s: terminated by signal %d", *argv, WTERMSIG(status)); + ret = 128 + WTERMSIG(status); + } printf("%.*s", (int)nread, out); |