summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoroshogbo <oshogbo@FreeBSD.org>2016-06-13 00:03:55 +0000
committeroshogbo <oshogbo@FreeBSD.org>2016-06-13 00:03:55 +0000
commit891559e499c0d2d1d6203ec3540ff759160338f3 (patch)
tree92cd95db81c19ce14bd185dd5f3704ccf8c0acc9 /lib
parent9cb15c34bcff3f1c452cc9e50533537e1c1760d4 (diff)
downloadFreeBSD-src-891559e499c0d2d1d6203ec3540ff759160338f3.zip
FreeBSD-src-891559e499c0d2d1d6203ec3540ff759160338f3.tar.gz
Don't close fd if it's lower then stderr, otherwise we can close
one of the descriptor which we just set. Pointed out by: jilles Approved by: re (hrs)
Diffstat (limited to 'lib')
-rw-r--r--lib/libcasper/libcasper/service.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libcasper/libcasper/service.c b/lib/libcasper/libcasper/service.c
index 5231812..cc53d0d 100644
--- a/lib/libcasper/libcasper/service.c
+++ b/lib/libcasper/libcasper/service.c
@@ -360,7 +360,8 @@ stdnull(void)
if (dup2(fd, STDERR_FILENO) == -1)
errx(1, "Unable to cover stderr");
- close(fd);
+ if (fd > STDERR_FILENO)
+ close(fd);
}
static void
OpenPOWER on IntegriCloud