aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index c605a33e6..a703c5650 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -1983,7 +1983,7 @@ void commonChildInit(int stderrFd)
throw SysError("creating a new session");
/* Dup the write side of the logger pipe into stderr. */
- if (dup2(stderrFd, STDERR_FILENO) == -1)
+ if (stderrFd != -1 && dup2(stderrFd, STDERR_FILENO) == -1)
throw SysError("cannot pipe standard error into log file");
/* Dup stderr to stdout. */