summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7a18a26d1..ddd8a3a6e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -217,11 +217,13 @@ int main(int ac, char **av, char **envp)
if (Anope::Restarting)
{
- chdir(BinaryDir.c_str());
- Anope::string sbin = "./" + Anope::ServicesBin;
- av[0] = const_cast<char *>(sbin.c_str());
- execve(Anope::ServicesBin.c_str(), av, envp);
- Log() << "Restart failed";
+ if (chdir(BinaryDir.c_str()) != 0)
+ {
+ Anope::string sbin = "./" + Anope::ServicesBin;
+ av[0] = const_cast<char *>(sbin.c_str());
+ execve(Anope::ServicesBin.c_str(), av, envp);
+ }
+ Log() << "Restart failed: " << strerror(errno);
Anope::ReturnValue = -1;
}