diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-28 15:08:39 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-28 15:08:39 +0100 |
commit | d1342115cef053aff16cbec8e0736162c89bad4a (patch) | |
tree | 95fef88de8886eeaaaf5575ae8bbe5809f7060b7 | |
parent | daemonise: support keeping arbitrary fd:s open (diff) | |
download | slibc-d1342115cef053aff16cbec8e0736162c89bad4a.tar.gz slibc-d1342115cef053aff16cbec8e0736162c89bad4a.tar.bz2 slibc-d1342115cef053aff16cbec8e0736162c89bad4a.tar.xz |
fix dup_at_least_3: must duplicate at least once
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r-- | src/unistd/daemonise.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |