From d1342115cef053aff16cbec8e0736162c89bad4a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 28 Dec 2015 15:08:39 +0100 Subject: fix dup_at_least_3: must duplicate at least once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/unistd/daemonise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/unistd/daemonise.c b/src/unistd/daemonise.c index e61b72f..2936e31 100644 --- a/src/unistd/daemonise.c +++ b/src/unistd/daemonise.c @@ -57,7 +57,7 @@ static int dup_at_least_3(int old) int intermediary[] = { -1, -1, -1 }; int i, saved_errno; - while (old < 3) + do { if (old = dup(old), old == -1) goto fail; @@ -66,6 +66,7 @@ static int dup_at_least_3(int old) abort(); intermediary[i++] = old; } + while (old < 3); fail: saved_errno = errno; -- cgit v1.2.3-70-g09d2