This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fix incorrect check of return code from dup

  • Loading branch information...
XinyuHou
XinyuHou committed Dec 7, 2016
1 parent 3b92a87 commit 74d63df24445cdb95f88f97d8008fb43443bfbc0
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/lib/arch/unix/ArchDaemonUnix.cpp
@@ -117,9 +117,11 @@ ArchDaemonUnix::daemonize(const char* name, DaemonFunc func)
open("/dev/null", O_RDWR);
int dupErr = dup(1);
- if (dupErr)
+
+ if (dupErr < 0) {
// NB: file logging actually isn't working at this point!
LOG((CLOG_ERR "dup error: %i", dupErr));
+ }
#ifdef __APPLE__
return execSelfNonDaemonized();

0 comments on commit 74d63df

Please sign in to comment.