diff --git a/src/firejail/join.c b/src/firejail/join.c index 394bbb52891..e07e149ca12 100644 --- a/src/firejail/join.c +++ b/src/firejail/join.c @@ -536,7 +536,6 @@ void join(pid_t pid, int argc, char **argv, int index) { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); #ifdef HAVE_APPARMOR - // add apparmor confinement after the execve set_apparmor(); #endif @@ -601,9 +600,9 @@ void join(pid_t pid, int argc, char **argv, int index) { if (WIFEXITED(status)) { status = WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { - status = WTERMSIG(status); + status = 128 + WTERMSIG(status); } else { - status = 0; + status = -1; } exit(status); diff --git a/src/firejail/main.c b/src/firejail/main.c index e0bf44f62fa..90d29f2359d 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -3216,10 +3216,10 @@ printf("link #%s#\n", prf->link); if (WIFEXITED(status)){ myexit(WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { - myexit(WTERMSIG(status)); + myexit(128 + WTERMSIG(status)); } else { - myexit(0); + myexit(1); } - return 0; + return 1; } diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index 59ddfb85585..c02aa06824e 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c @@ -1243,7 +1243,6 @@ int sandbox(void* sandbox_arg) { if (app_pid == 0) { #ifdef HAVE_APPARMOR - // add apparmor confinement after the execve set_apparmor(); #endif @@ -1262,9 +1261,13 @@ int sandbox(void* sandbox_arg) { if (WIFEXITED(status)) { // if we had a proper exit, return that exit status - return WEXITSTATUS(status); + status = WEXITSTATUS(status); + } else if (WIFSIGNALED(status)) { + // distinguish fatal signals by adding 128 + status = 128 + WTERMSIG(status); } else { - // something else went wrong! - return -1; + status = -1; } + + return status; }