Browse Source

* sane log messages: DaemonLinux.cpp

pull/317/head
hagen 9 years ago
parent
commit
19c74ce9fa
  1. 8
      DaemonLinux.cpp

8
DaemonLinux.cpp

@ -26,7 +26,7 @@ void handle_signal(int sig)
return; return;
} }
} }
LogPrint("Reloading config."); LogPrint(eLogInfo, "Daemon: Got SIGHUP, reloading config.");
i2p::util::filesystem::ReadConfigFile(i2p::util::config::mapArgs, i2p::util::config::mapMultiArgs); i2p::util::filesystem::ReadConfigFile(i2p::util::config::mapArgs, i2p::util::config::mapMultiArgs);
break; break;
case SIGABRT: case SIGABRT:
@ -59,7 +59,7 @@ namespace i2p
int sid = setsid(); int sid = setsid();
if (sid < 0) if (sid < 0)
{ {
LogPrint("Error, could not create process group."); LogPrint(eLogError, "Daemon: could not create process group.");
return false; return false;
} }
std::string d(i2p::util::filesystem::GetDataDir().string ()); // make a copy std::string d(i2p::util::filesystem::GetDataDir().string ()); // make a copy
@ -80,12 +80,12 @@ namespace i2p
pidFilehandle = open(pidfile.c_str(), O_RDWR | O_CREAT, 0600); pidFilehandle = open(pidfile.c_str(), O_RDWR | O_CREAT, 0600);
if (pidFilehandle == -1) if (pidFilehandle == -1)
{ {
LogPrint("Error, could not create pid file (", pidfile, ")\nIs an instance already running?"); LogPrint(eLogError, "Daemon: could not create pid file ", pidfile, ": ", strerror(errno));
return false; return false;
} }
if (lockf(pidFilehandle, F_TLOCK, 0) == -1) if (lockf(pidFilehandle, F_TLOCK, 0) == -1)
{ {
LogPrint("Error, could not lock pid file (", pidfile, ")\nIs an instance already running?"); LogPrint(eLogError, "Daemon: could not lock pid file ", pidfile, ": ", strerror(errno));
return false; return false;
} }
char pid[10]; char pid[10];

Loading…
Cancel
Save