aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2019-07-04 17:48:48 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2019-07-04 17:48:48 -0400
commitd6908423468a90e8b0e0ea0aca6455a05fdb147f (patch)
tree344b4d30052f0677a4fe1997909409bb64ab55b9
parentFix seccomp sorting in riot-desktop (diff)
downloadfirejail-d6908423468a90e8b0e0ea0aca6455a05fdb147f.tar.gz
firejail-d6908423468a90e8b0e0ea0aca6455a05fdb147f.tar.zst
firejail-d6908423468a90e8b0e0ea0aca6455a05fdb147f.zip
fix --timeout
-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 }