From d6908423468a90e8b0e0ea0aca6455a05fdb147f Mon Sep 17 00:00:00 2001 From: netblue30 Date: Thu, 4 Jul 2019 17:48:48 -0400 Subject: fix --timeout --- src/firejail/sandbox.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index f91e5ab7c..288726d22 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c @@ -268,6 +268,7 @@ static int monitor_application(pid_t app_pid) { if (cfg.timeout) { options = WNOHANG; timeout = cfg.timeout; + sleep(1); } int status = 0; @@ -302,8 +303,11 @@ static int monitor_application(pid_t app_pid) { // handle --timeout if (options) { if (--timeout == 0) { + // SIGTERM might fail if the process ignores it (SIG_IGN) + // we give it 100ms to close properly and after that we SIGKILL it kill(-1, SIGTERM); - sleep(1); + usleep(100000); + kill(-1, SIGKILL); flush_stdin(); _exit(1); } -- cgit v1.2.3-70-g09d2