From 2348bf307ca32bb65b54017ee1906fda48b55087 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 14 Jun 2005 13:47:09 +0000 Subject: *** empty log message *** --- src/daemon.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/daemon.cc') diff --git a/src/daemon.cc b/src/daemon.cc index e80af78..fc42ee7 100644 --- a/src/daemon.cc +++ b/src/daemon.cc @@ -40,7 +40,7 @@ Daemon::~Daemon() int Daemon::run(uid_t uid, gid_t gid) { int f; - // int fd; + int fd; chdir("/"); umask(0); @@ -62,13 +62,14 @@ int Daemon::run(uid_t uid, gid_t gid) fprintf(stderr, "Failed to change to uid %d, quitting.\n", uid); return 1; } - /* // Redirect stdin, stdout and stderr to /dev/null + + // Redirect stdin, stdout and stderr to /dev/null fd = open("/dev/null", O_NOCTTY | O_RDWR, 0666); dup2(0, fd); dup2(1, fd); dup2(2, fd); - */ + setsid(); signal (SIGTERM, SIG_IGN); -- cgit v1.2.3