From 894b94fd2d2fe6f94c3b629eb813f0bf75001ae5 Mon Sep 17 00:00:00 2001 From: smitsohu Date: Fri, 17 Jan 2020 23:14:09 +0100 Subject: fix join timeout if sleep interval is not a multiple --- etc/firejail.config | 6 +++--- src/firejail/join.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/firejail.config b/etc/firejail.config index 3bff2f7ed..6fb7d829a 100644 --- a/etc/firejail.config +++ b/etc/firejail.config @@ -62,9 +62,9 @@ # root user can always join sandboxes. # join yes -# Timeout when joining a sandbox, default five seconds. Wait up to -# the specified period of time to allow sandbox setup to finish. -# It is not possible to join a sandbox while it is still starting up. +# Timeout when joining a sandbox, default five seconds. It is not +# possible to join a sandbox while it is still starting up. Wait up +# to the specified period of time to allow sandbox setup to finish. # join-timeout 5 # Enable or disable sandbox name change, default enabled. diff --git a/src/firejail/join.c b/src/firejail/join.c index 1494c782f..f61e50d31 100644 --- a/src/firejail/join.c +++ b/src/firejail/join.c @@ -322,8 +322,8 @@ bool is_ready_for_join(const pid_t pid) { void check_join_permission(pid_t pid) { // check if pid belongs to a fully set up firejail sandbox unsigned long i; - for (i = 0; is_ready_for_join(pid) == false; i += SNOOZE) { // give sandbox some time to start up - if (i >= join_timeout) { + for (i = SNOOZE; is_ready_for_join(pid) == false; i += SNOOZE) { // give sandbox some time to start up + if (i > join_timeout) { fprintf(stderr, "Error: no valid sandbox\n"); exit(1); } -- cgit v1.2.3-54-g00ecf