From 1650db5c78153cc3c92969f178f826e1991771d4 Mon Sep 17 00:00:00 2001 From: Paweł Date: Sun, 14 Oct 2018 13:44:26 +0200 Subject: Make --join return exit code of the invoked program --- src/firejail/join.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/firejail/join.c b/src/firejail/join.c index c2b207c52..c849b200c 100644 --- a/src/firejail/join.c +++ b/src/firejail/join.c @@ -436,8 +436,18 @@ void join(pid_t pid, int argc, char **argv, int index) { // it will never get here!!! } + int status = 0; // wait for the child to finish - waitpid(child, NULL, 0); + waitpid(child, &status, 0); flush_stdin(); - exit(0); + + if (WIFEXITED(status)) { + status = WEXITSTATUS(status); + } else if (WIFSIGNALED(status)) { + status = WTERMSIG(status); + } else { + status = 0; + } + + exit(status); } -- cgit v1.2.3-54-g00ecf