aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar startx2017 <vradu.startx@yandex.com>2018-10-14 18:53:33 -0400
committerLibravatar GitHub <noreply@github.com>2018-10-14 18:53:33 -0400
commitae3d1888a384314d89164ff43a598465ff67ff9b (patch)
treec2a5edbe64ba4bfed6cd087bdea7babafeee8505
parentMerge branch 'master' of https://github.com/netblue30/firejail (diff)
parentMake --join return exit code of the invoked program (diff)
downloadfirejail-ae3d1888a384314d89164ff43a598465ff67ff9b.tar.gz
firejail-ae3d1888a384314d89164ff43a598465ff67ff9b.tar.zst
firejail-ae3d1888a384314d89164ff43a598465ff67ff9b.zip
Merge pull request #2193 from grimskies/join-exit-code
Make --join return exit code of the invoked program
-rw-r--r--src/firejail/join.c14
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}