From ab2577ce0a5b04e40636b81693bc91eedb96eaea Mon Sep 17 00:00:00 2001 From: R4SAS Date: Fri, 18 Feb 2022 21:00:10 +0300 Subject: [PATCH] [daemon] print errors to stdout Signed-off-by: R4SAS --- daemon/UnixDaemon.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/daemon/UnixDaemon.cpp b/daemon/UnixDaemon.cpp index 105f60be..563a0f54 100644 --- a/daemon/UnixDaemon.cpp +++ b/daemon/UnixDaemon.cpp @@ -73,6 +73,7 @@ namespace i2p if (pid < 0) // error { LogPrint(eLogError, "Daemon: Could not fork: ", strerror(errno)); + std::cerr << "i2pd: Could not fork: " << strerror(errno) << std::endl; return false; } @@ -82,12 +83,14 @@ namespace i2p if (sid < 0) { LogPrint(eLogError, "Daemon: Could not create process group."); + std::cerr << "i2pd: Could not create process group." << std::endl; return false; } std::string d = i2p::fs::GetDataDir(); if (chdir(d.c_str()) != 0) { LogPrint(eLogError, "Daemon: Could not chdir: ", strerror(errno)); + std::cerr << "i2pd: Could not chdir: " << strerror(errno) << std::endl; return false; } @@ -144,6 +147,7 @@ namespace i2p if (pidFH < 0) { LogPrint(eLogError, "Daemon: Could not create pid file ", pidfile, ": ", strerror(errno)); + std::cerr << "i2pd: Could not create pid file " << pidfile << ": " << strerror(errno) << std::endl; return false; } @@ -151,6 +155,7 @@ namespace i2p if (lockf(pidFH, F_TLOCK, 0) != 0) { LogPrint(eLogError, "Daemon: Could not lock pid file ", pidfile, ": ", strerror(errno)); + std::cerr << "i2pd: Could not lock pid file " << pidfile << ": " << strerror(errno) << std::endl; return false; } #endif @@ -159,7 +164,8 @@ namespace i2p ftruncate(pidFH, 0); if (write(pidFH, pid, strlen(pid)) < 0) { - LogPrint(eLogError, "Daemon: Could not write pidfile: ", strerror(errno)); + LogPrint(eLogError, "Daemon: Could not write pidfile ", pidfile, ": ", strerror(errno)); + std::cerr << "i2pd: Could not write pidfile " << pidfile << ": " << strerror(errno) << std::endl; return false; } }