]> Trent Huber's Code - cbs.git/commitdiff
Message for child process terminated by signal
authorTrent Huber <trentmhuber@gmail.com>
Sat, 26 Jul 2025 16:12:42 +0000 (12:12 -0400)
committerTrent Huber <trentmhuber@gmail.com>
Sat, 26 Jul 2025 16:12:42 +0000 (12:12 -0400)
cbs.c

diff --git a/cbs.c b/cbs.c
index 53c44f8f67c2f65a6e1f63d8c97369e768eb88e4..8bc47d94d7662670cf59c80e394ec82d8120f75d 100644 (file)
--- a/cbs.c
+++ b/cbs.c
@@ -77,8 +77,9 @@ void await(pid_t cpid, char *what, char *who) {
 
    if (cpid == -1 || waitpid(cpid, &status, 0) == -1)
        err(EXIT_FAILURE, "Unable to %s `%s'", what, who);
-   if (WIFEXITED(status) && WEXITSTATUS(status) != EXIT_SUCCESS
-       || WIFSIGNALED(status))
+   if (WIFSIGNALED(status))
+       errx(EXIT_FAILURE, "%s", strsignal(WTERMSIG(status)));
+   if (WIFEXITED(status) && WEXITSTATUS(status) != EXIT_SUCCESS)
        exit(EXIT_FAILURE);
 }