diff options
Diffstat (limited to 'src/firejail/shutdown.c')
-rw-r--r-- | src/firejail/shutdown.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/firejail/shutdown.c b/src/firejail/shutdown.c index b70394bc8..afe7109a8 100644 --- a/src/firejail/shutdown.c +++ b/src/firejail/shutdown.c | |||
@@ -52,15 +52,18 @@ void shut(pid_t pid) { | |||
52 | printf("Sending SIGTERM to %u\n", pid); | 52 | printf("Sending SIGTERM to %u\n", pid); |
53 | kill(pid, SIGTERM); | 53 | kill(pid, SIGTERM); |
54 | 54 | ||
55 | // wait for not more than 10 seconds | 55 | // wait for not more than about 10 seconds |
56 | sleep(2); | 56 | int monsec = 10; |
57 | int monsec = 8; | ||
58 | char *monfile; | 57 | char *monfile; |
59 | if (asprintf(&monfile, "/proc/%d/cmdline", pid) == -1) | 58 | if (asprintf(&monfile, "/proc/%d/cmdline", pid) == -1) |
60 | errExit("asprintf"); | 59 | errExit("asprintf"); |
61 | int killdone = 0; | 60 | int killdone = 0; |
62 | 61 | ||
62 | usleep(200000) // give sandbox a little head start | ||
63 | while (monsec) { | 63 | while (monsec) { |
64 | sleep(1); | ||
65 | monsec--; | ||
66 | |||
64 | FILE *fp = fopen(monfile, "r"); | 67 | FILE *fp = fopen(monfile, "r"); |
65 | if (!fp) { | 68 | if (!fp) { |
66 | killdone = 1; | 69 | killdone = 1; |
@@ -75,9 +78,6 @@ void shut(pid_t pid) { | |||
75 | killdone = 1; | 78 | killdone = 1; |
76 | break; | 79 | break; |
77 | } | 80 | } |
78 | |||
79 | sleep(1); | ||
80 | monsec--; | ||
81 | } | 81 | } |
82 | free(monfile); | 82 | free(monfile); |
83 | 83 | ||