aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-11-18 13:24:42 -0600
committerluigi1111 <luigi1111w@gmail.com>2019-11-18 13:24:42 -0600
commit81da5246e465252b76b26c4127106bb33b3452e1 (patch)
tree27f0ed69fbfafb5bfaaaa61b756b8c6ff2ea5f3c /src
parentMerge pull request #6118 (diff)
parentFix #6147 DB corruption from child process overwrite (diff)
downloadmonero-81da5246e465252b76b26c4127106bb33b3452e1.tar.xz
Merge pull request #6148
47d094c Fix #6147 DB corruption from child process overwrite (hyc)
Diffstat (limited to 'src')
-rw-r--r--src/daemonizer/posix_fork.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/daemonizer/posix_fork.cpp b/src/daemonizer/posix_fork.cpp
index 5af4e1a4a..16758215d 100644
--- a/src/daemonizer/posix_fork.cpp
+++ b/src/daemonizer/posix_fork.cpp
@@ -127,13 +127,18 @@ void fork(const std::string & pidfile)
{
quit("Unable to open output file: " + output);
}
+#else
+ if (open("/dev/null", O_WRONLY) < 0)
+ {
+ quit("Unable to open /dev/null");
+ }
+#endif
// Also send standard error to the same log file.
if (dup(1) < 0)
{
quit("Unable to dup output descriptor");
}
-#endif
}
} // namespace posix