From: Gustavo Martin Morcuende Date: Thu, 29 Aug 2013 00:51:49 +0000 (+0200) Subject: Doubts about setsid. TODO some day. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=89da82a2356f0f656feb104aae043f9f89cc94b4;p=JavaTCPFork%2F.git Doubts about setsid. TODO some day. --- diff --git a/Daemon/javafork.c b/Daemon/javafork.c index 5500539..2f56b58 100644 --- a/Daemon/javafork.c +++ b/Daemon/javafork.c @@ -59,11 +59,15 @@ int main (int argc, char *argv[]) /*This process is intended to be used as a daemon, it sould be launched by the INIT process, because of that*/ /*we are not forking it (INIT needs it)*/ + /*TODO: I think this is not needed because setsid function performs it*/ if (daemonize(argv[0], LOG_SYSLOG, LOG_PID) < 0) return -1; /*Changing session.*/ - setsid(); + if (setsid() < 0) { + syslog (LOG_ERR, "setsid failed: %m"); + return -1; + } opterr = 0;