Merge pull request #6148

47d094c Fix #6147 DB corruption from child process overwrite (hyc)
This commit is contained in:
luigi1111 2019-11-18 13:24:42 -06:00
commit 81da5246e4
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010

View File

@ -127,13 +127,18 @@ void fork(const std::string & pidfile)
{ {
quit("Unable to open output file: " + output); 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. // Also send standard error to the same log file.
if (dup(1) < 0) if (dup(1) < 0)
{ {
quit("Unable to dup output descriptor"); quit("Unable to dup output descriptor");
} }
#endif
} }
} // namespace posix } // namespace posix