diff options
author | Christian Pointner <equinox@anytun.org> | 2008-04-11 16:13:33 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2008-04-11 16:13:33 +0000 |
commit | ce684962c9545499ee26aed97b0e63f0e98b9841 (patch) | |
tree | dc652340f1cf7a08b88077f5d343d8f2a73b5d62 /anytun.cpp | |
parent | fixed issue with pid file and chrooting to early (diff) |
fixed issue with closing to much files @ daemonize
Diffstat (limited to 'anytun.cpp')
-rw-r--r-- | anytun.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -385,7 +385,8 @@ void daemonize() // std::cout << "running in background now..." << std::endl; int fd; - for (fd=getdtablesize();fd>=0;--fd) // close all file descriptors +// for (fd=getdtablesize();fd>=0;--fd) // close all file descriptors + for (fd=0;fd<=2;fd++) // close all file descriptors close(fd); fd=open("/dev/null",O_RDWR); // stdin dup(fd); // stdout @@ -428,6 +429,7 @@ int main(int argc, char* argv[]) chrootAndDrop(gOpt.getChrootDir(), gOpt.getUsername()); if(gOpt.getDaemonize()) daemonize(); + if(pidFile.is_open()) { pid_t pid = getpid(); pidFile << pid; |