monerod: do not log to tmpdir in daemon mode

The logging to /tmp/bitmonero.daemon.stdout.stderr caused segfaults
if the /tmp mount was full (#2851).
Now the daemon is only logging to /tmp/bitmonero.daemon.stdout.stderr
in the debug builds.
This commit is contained in:
ston1th 2018-02-13 19:54:49 +01:00
parent ed67e5c001
commit 496055d128
2 changed files with 6 additions and 0 deletions

View File

@ -54,6 +54,10 @@ else()
) )
endif() endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG_TMPDIR_LOG=1)
endif()
monero_private_headers(daemonizer monero_private_headers(daemonizer
${daemonizer_private_headers}) ${daemonizer_private_headers})
monero_add_library(daemonizer monero_add_library(daemonizer

View File

@ -115,6 +115,7 @@ void fork(const std::string & pidfile)
quit("Unable to open /dev/null"); quit("Unable to open /dev/null");
} }
#ifdef DEBUG_TMPDIR_LOG
// Send standard output to a log file. // Send standard output to a log file.
const char *tmpdir = getenv("TMPDIR"); const char *tmpdir = getenv("TMPDIR");
if (!tmpdir) if (!tmpdir)
@ -133,6 +134,7 @@ void fork(const std::string & pidfile)
{ {
quit("Unable to dup output descriptor"); quit("Unable to dup output descriptor");
} }
#endif
} }
} // namespace posix } // namespace posix