1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 01:56:38 +02:00

Fix some compiler warnings from not checking chdir.

This commit is contained in:
Sadie Powell
2024-11-07 19:34:46 +00:00
parent 51827b94ad
commit 1393518555
2 changed files with 8 additions and 6 deletions
+7 -5
View File
@@ -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;
}