summaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-05-31 20:57:48 +0100
committerSadie Powell <sadie@witchery.services>2021-05-31 20:57:48 +0100
commitdf4313f5bbacbfcb6592b6d90fe5362192287d59 (patch)
treef16f74b745083d6f8575d86c8d19565869c4d9c4 /src/init.cpp
parent53cd3f47b5c5afa503e96380e9e22d7d35108714 (diff)
parent3728a0bda1cf010520c4fae821fc9c98b2adb083 (diff)
Merge branch '2.0' into 2.1.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 049829bc4..7186cccfc 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -106,9 +106,12 @@ void Anope::Fork()
#ifndef _WIN32
kill(getppid(), SIGUSR2);
- freopen("/dev/null", "r", stdin);
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
+ if (!freopen("/dev/null", "r", stdin))
+ Log() << "Unable to redirect stdin to /dev/null: " << Anope::LastError();
+ if (!freopen("/dev/null", "w", stdout))
+ Log() << "Unable to redirect stdout to /dev/null: " << Anope::LastError();
+ if (!freopen("/dev/null", "w", stderr))
+ Log() << "Unable to redirect stderr to /dev/null: " << Anope::LastError();
setpgid(0, 0);
@@ -263,7 +266,9 @@ static void setuidgid()
{
LogFile* lf = li.logfiles[j];
- chown(lf->filename.c_str(), uid, gid);
+ errno = 0;
+ if (chown(lf->filename.c_str(), uid, gid) != 0)
+ Log() << "Unable to change the ownership of " << lf->filename << " to " << uid << "/" << gid << ": " << Anope::LastError();
}
}