aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/join.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/firejail/join.c')
-rw-r--r--src/firejail/join.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/firejail/join.c b/src/firejail/join.c
index 394bbb528..99fbfdd0a 100644
--- a/src/firejail/join.c
+++ b/src/firejail/join.c
@@ -45,7 +45,7 @@ static unsigned display = 0;
45static void signal_handler(int sig){ 45static void signal_handler(int sig){
46 flush_stdin(); 46 flush_stdin();
47 47
48 exit(sig); 48 exit(128 + sig);
49} 49}
50 50
51static void install_handler(void) { 51static void install_handler(void) {
@@ -536,7 +536,6 @@ void join(pid_t pid, int argc, char **argv, int index) {
536 prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); 536 prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
537 537
538#ifdef HAVE_APPARMOR 538#ifdef HAVE_APPARMOR
539 // add apparmor confinement after the execve
540 set_apparmor(); 539 set_apparmor();
541#endif 540#endif
542 541
@@ -596,15 +595,17 @@ void join(pid_t pid, int argc, char **argv, int index) {
596 595
597 // end of signal-safe code 596 // end of signal-safe code
598 //***************************** 597 //*****************************
599 flush_stdin();
600 598
601 if (WIFEXITED(status)) { 599 if (WIFEXITED(status)) {
600 // if we had a proper exit, return that exit status
602 status = WEXITSTATUS(status); 601 status = WEXITSTATUS(status);
603 } else if (WIFSIGNALED(status)) { 602 } else if (WIFSIGNALED(status)) {
604 status = WTERMSIG(status); 603 // distinguish fatal signals by adding 128
604 status = 128 + WTERMSIG(status);
605 } else { 605 } else {
606 status = 0; 606 status = -1;
607 } 607 }
608 608
609 flush_stdin();
609 exit(status); 610 exit(status);
610} 611}