From a3c6ed4dd2ac9b8f3f29d70cfd9473359e07f389 Mon Sep 17 00:00:00 2001 From: hagen Date: Mon, 11 Jan 2016 11:30:19 +0000 Subject: [PATCH] * fix warnings from -Wunused-result --- DaemonLinux.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/DaemonLinux.cpp b/DaemonLinux.cpp index 31ec209c..d94ede7f 100644 --- a/DaemonLinux.cpp +++ b/DaemonLinux.cpp @@ -66,7 +66,11 @@ namespace i2p return false; } std::string d(i2p::util::filesystem::GetDataDir().string ()); // make a copy - chdir(d.c_str()); + if (chdir(d.c_str()) != 0) + { + LogPrint(eLogError, "Daemon: could not chdir: ", strerror(errno)); + return false; + } // close stdin/stdout/stderr descriptors ::close (0); @@ -95,7 +99,11 @@ namespace i2p char pid[10]; sprintf(pid, "%d\n", getpid()); ftruncate(pidFH, 0); - write(pidFH, pid, strlen(pid)); + if (write(pidFH, pid, strlen(pid)) < 0) + { + LogPrint(eLogError, "Daemon: could not write pidfile: ", strerror(errno)); + return false; + } } // Signal handler