From 371daf9928def23164b49b39ced1d3cdeb9225b8 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 23 Dec 2006 14:06:57 +0000 Subject: Refactored /RESTART (and added InspIRCd::Restart(reason)) Fixed bug in m_ziplinks, assigning instead of testing a var (gcc 4.1.1 picked up on this, 3.4 didnt) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6067 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 54c3aa0ab..670fb5ef7 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -66,6 +66,18 @@ void InspIRCd::Exit(int status) exit (status); } +void InspIRCd::Restart(const std::string &reason) +{ + this->SendError(reason); + std::string me = Config->MyDir + "/inspircd"; + this->Logger->Close(); + if (execv(me.c_str(), Config->argv) == -1) + { + /* Will raise a SIGABRT if not trapped */ + throw CoreException(std::string("Failed to execv()! error: ") + strerror(errno)); + } +} + void InspIRCd::Start() { printf("\033[1;32mInspire Internet Relay Chat Server, compiled %s at %s\n",__DATE__,__TIME__); -- cgit v1.2.3