X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fngircd.c;h=f0cb15045993b9a5df1d587f7d19d343c4cc6797;hb=37609d6a4f036b175fdc304d0ee466bd8ad57bf9;hp=e28c370b47af675ab000cf28bf9add9e0afc529d;hpb=d38d153f51738da31d40036c7c48b32d82234018;p=ngircd-alex.git diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c index e28c370b..f0cb1504 100644 --- a/src/ngircd/ngircd.c +++ b/src/ngircd/ngircd.c @@ -551,7 +551,7 @@ Pidfile_Create(pid_t pid) /** - * Redirect stdin, stdout and stderr to apropriate file handles. + * Redirect stdin, stdout and stderr to appropriate file handles. * * @param fd The file handle stdin, stdout and stderr should be redirected to. */ @@ -720,10 +720,17 @@ NGIRCd_Init(bool NGIRCd_NoDaemon) grp = getgrgid(Conf_GID); Log(LOG_ERR, "Can't change group ID to %s(%u): %s!", grp ? grp->gr_name : "?", Conf_GID, - strerror(errno)); + strerror(real_errno)); if (real_errno != EPERM) goto out; } + if (setgroups(0, NULL) != 0) { + real_errno = errno; + Log(LOG_ERR, "Can't drop supplementary group IDs: %s!", + strerror(errno)); + if (real_errno != EPERM) + goto out; + } } #endif @@ -734,7 +741,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon) pwd = getpwuid(Conf_UID); Log(LOG_ERR, "Can't change user ID to %s(%u): %s!", pwd ? pwd->pw_name : "?", Conf_UID, - strerror(errno)); + strerror(real_errno)); if (real_errno != EPERM) goto out; }