diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-16 16:11:00 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-16 16:11:00 +0000 |
commit | de46c72bb1dc98e1a421d56028ebf21c57424c0c (patch) | |
tree | d997bfff373c107efebd13392feb0a599e2221d9 /src | |
parent | 5025402f6c8f94aa26fc0649eb0403f9988fa1a2 (diff) |
Fix the restart stuff that bricker noticed while testing an feature request
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6804 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 771d8b73b..6aa6c9519 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -286,7 +286,7 @@ InspIRCd::InspIRCd(int argc, char** argv) { int found_ports = 0; FailedPortList pl; - int do_version = 0, do_nofork = 0, do_debug = 0, do_nolog = 0, do_restart = 0, do_root = 0; /* flag variables */ + int do_version = 0, do_nofork = 0, do_debug = 0, do_nolog = 0, do_root = 0; /* flag variables */ char c = 0; modules.resize(255); @@ -320,7 +320,6 @@ InspIRCd::InspIRCd(int argc, char** argv) { "config", required_argument, NULL, 'c' }, { "debug", no_argument, &do_debug, 1 }, { "nolog", no_argument, &do_nolog, 1 }, - { "restart", no_argument, &do_restart, 1 }, { "runasroot", no_argument, &do_root, 1 }, { "version", no_argument, &do_version, 1 }, { 0, 0, 0, 0 } @@ -464,8 +463,12 @@ InspIRCd::InspIRCd(int argc, char** argv) } } - if (!Config->nofork && !do_restart) + if (!Config->nofork && 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 + */ if (kill(getppid(), SIGTERM) == -1) { printf("Error killing parent process: %s\n",strerror(errno)); |