From 6ae4d342bdc0b11ae6966bd83a596d6ae77a7a5f Mon Sep 17 00:00:00 2001 From: netblue30 Date: Sun, 29 Oct 2017 16:05:23 -0400 Subject: --timeout testing and fixes (#1614) --- src/firejail/fs_hostname.c | 2 +- src/firejail/sandbox.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/firejail/fs_hostname.c b/src/firejail/fs_hostname.c index 0cf715fe2..15c8f5e36 100644 --- a/src/firejail/fs_hostname.c +++ b/src/firejail/fs_hostname.c @@ -94,7 +94,7 @@ void fs_resolvconf(void) { struct stat s; - // create a new /etc/hostname + // create a new /etc/resolv.conf if (stat("/etc/resolv.conf", &s) == 0) { if (arg_debug) printf("Creating a new /etc/resolv.conf file\n"); diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index d797cee61..b413407bd 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c @@ -227,11 +227,15 @@ static int monitor_application(pid_t app_pid) { break; // handle --timeout - if (options && --timeout == 0) { - kill(-1, SIGTERM); - flush_stdin(); - sleep(1); - _exit(1); + if (options) { + if (--timeout == 0) { + kill(-1, SIGTERM); + flush_stdin(); + sleep(1); + _exit(1); + } + else + sleep(1); } } while(rv != monitored_pid); -- cgit v1.2.3-70-g09d2