diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-20 16:37:37 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-20 16:37:37 +0000 |
commit | 1dbe2fe17f5907dae94c292e46c99299d13cbe34 (patch) | |
tree | 042a9c9f5556e73783dcf78d8f393e3dcf97ccb9 | |
parent | 6248c525600c56cbf689359404f973d629322d86 (diff) |
Fix for "hanging" when controlling terminal is not a tty (nofork check and isatty checks lumped together by mistake)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6818 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/inspircd.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 6aa6c9519..bacd92961 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -463,18 +463,21 @@ InspIRCd::InspIRCd(int argc, char** argv) } } - if (!Config->nofork && isatty(0) && isatty(1) && isatty(2)) + if (!Config->nofork) { - /* We didn't start from a TTY, we must have started from a background process - - * e.g. we are restarting, or being launched by cron. Dont kill parent, and dont - * close stdin/stdout - */ if (kill(getppid(), SIGTERM) == -1) { printf("Error killing parent process: %s\n",strerror(errno)); Log(DEFAULT,"Error killing parent process: %s",strerror(errno)); } + } + if (isatty(0) && isatty(1) && isatty(2)) + { + /* We didn't start from a TTY, we must have started from a background process - + * e.g. we are restarting, or being launched by cron. Dont kill parent, and dont + * close stdin/stdout + */ fclose(stdin); fclose(stderr); fclose(stdout); |