summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/init.cpp2
-rw-r--r--src/main.cpp12
2 files changed, 8 insertions, 6 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 309bb3117..8e79bd5bb 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -427,7 +427,7 @@ bool Anope::Init(int ac, char **av)
/* Chdir to Anope data directory. */
Log() << "Moving to " << Anope::ServicesDir;
- if (chdir(Anope::ServicesDir.c_str()) < 0)
+ if (chdir(Anope::ServicesDir.c_str()) != 0)
{
throw CoreException("Unable to chdir to " + Anope::ServicesDir + ": " + Anope::LastError());
}
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;
}