diff options
Diffstat (limited to 'src/firejail/join.c')
-rw-r--r-- | src/firejail/join.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/firejail/join.c b/src/firejail/join.c index b05e25387..575baf71e 100644 --- a/src/firejail/join.c +++ b/src/firejail/join.c | |||
@@ -29,6 +29,12 @@ static uint64_t caps = 0; | |||
29 | static int apply_seccomp = 0; | 29 | static int apply_seccomp = 0; |
30 | #define BUFLEN 4096 | 30 | #define BUFLEN 4096 |
31 | 31 | ||
32 | static void signal_handler(int sig){ | ||
33 | flush_stdin(); | ||
34 | |||
35 | exit(sig); | ||
36 | } | ||
37 | |||
32 | static void extract_command(int argc, char **argv, int index) { | 38 | static void extract_command(int argc, char **argv, int index) { |
33 | if (index >= argc) | 39 | if (index >= argc) |
34 | return; | 40 | return; |
@@ -194,6 +200,7 @@ void join_name(const char *name, const char *homedir, int argc, char **argv, int | |||
194 | 200 | ||
195 | void join(pid_t pid, const char *homedir, int argc, char **argv, int index) { | 201 | void join(pid_t pid, const char *homedir, int argc, char **argv, int index) { |
196 | extract_command(argc, argv, index); | 202 | extract_command(argc, argv, index); |
203 | signal (SIGTERM, signal_handler); | ||
197 | 204 | ||
198 | // if the pid is that of a firejail process, use the pid of the first child process | 205 | // if the pid is that of a firejail process, use the pid of the first child process |
199 | char *comm = pid_proc_comm(pid); | 206 | char *comm = pid_proc_comm(pid); |
@@ -388,6 +395,7 @@ void join(pid_t pid, const char *homedir, int argc, char **argv, int index) { | |||
388 | 395 | ||
389 | // wait for the child to finish | 396 | // wait for the child to finish |
390 | waitpid(child, NULL, 0); | 397 | waitpid(child, NULL, 0); |
398 | flush_stdin(); | ||
391 | exit(0); | 399 | exit(0); |
392 | } | 400 | } |
393 | 401 | ||