aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/firejail/sandbox.c6
1 files changed, 5 insertions, 1 deletions
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) {
268 if (cfg.timeout) { 268 if (cfg.timeout) {
269 options = WNOHANG; 269 options = WNOHANG;
270 timeout = cfg.timeout; 270 timeout = cfg.timeout;
271 sleep(1);
271 } 272 }
272 273
273 int status = 0; 274 int status = 0;
@@ -302,8 +303,11 @@ static int monitor_application(pid_t app_pid) {
302 // handle --timeout 303 // handle --timeout
303 if (options) { 304 if (options) {
304 if (--timeout == 0) { 305 if (--timeout == 0) {
306 // SIGTERM might fail if the process ignores it (SIG_IGN)
307 // we give it 100ms to close properly and after that we SIGKILL it
305 kill(-1, SIGTERM); 308 kill(-1, SIGTERM);
306 sleep(1); 309 usleep(100000);
310 kill(-1, SIGKILL);
307 flush_stdin(); 311 flush_stdin();
308 _exit(1); 312 _exit(1);
309 } 313 }