diff options
author | Paweł <grimskies@azath> | 2018-10-14 13:44:26 +0200 |
---|---|---|
committer | Paweł <grimskies@azath> | 2018-10-14 13:50:47 +0200 |
commit | 1650db5c78153cc3c92969f178f826e1991771d4 (patch) | |
tree | c2a5edbe64ba4bfed6cd087bdea7babafeee8505 /src | |
parent | Merge branch 'master' of https://github.com/netblue30/firejail (diff) | |
download | firejail-1650db5c78153cc3c92969f178f826e1991771d4.tar.gz firejail-1650db5c78153cc3c92969f178f826e1991771d4.tar.zst firejail-1650db5c78153cc3c92969f178f826e1991771d4.zip |
Make --join return exit code of the invoked program
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/join.c | 14 |
1 files 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) { | |||
436 | // it will never get here!!! | 436 | // it will never get here!!! |
437 | } | 437 | } |
438 | 438 | ||
439 | int status = 0; | ||
439 | // wait for the child to finish | 440 | // wait for the child to finish |
440 | waitpid(child, NULL, 0); | 441 | waitpid(child, &status, 0); |
441 | flush_stdin(); | 442 | flush_stdin(); |
442 | exit(0); | 443 | |
444 | if (WIFEXITED(status)) { | ||
445 | status = WEXITSTATUS(status); | ||
446 | } else if (WIFSIGNALED(status)) { | ||
447 | status = WTERMSIG(status); | ||
448 | } else { | ||
449 | status = 0; | ||
450 | } | ||
451 | |||
452 | exit(status); | ||
443 | } | 453 | } |