}
max_fd = max(max_fd, squid_link);
- setgid(getgid());
- setuid(getuid());
+ if (setgid(getgid()) < 0) {
+ debugs(42, DBG_CRITICAL, "FATAL: pinger: setgid(" << getgid() << ") failed: " << xstrerror());
+ icmp4.Close();
+ icmp6.Close();
+ exit (1);
+ }
+ if (setuid(getuid()) < 0) {
+ debugs(42, DBG_CRITICAL, "FATAL: pinger: setuid(" << getuid() << ") failed: " << xstrerror());
+ icmp4.Close();
+ icmp6.Close();
+ exit (1);
+ }
last_check_time = squid_curtime;
void
enter_suid(void)
{
- debugs(21, 3, "enter_suid: PID " << getpid() << " taking root priveleges");
+ debugs(21, 3, "enter_suid: PID " << getpid() << " taking root privileges");
#if HAVE_SETRESUID
-
- setresuid((uid_t)-1, 0, (uid_t)-1);
+ if (setresuid((uid_t)-1, 0, (uid_t)-1) < 0)
+ debugs (21, 3, "enter_suid: setresuid failed: " << xstrerror ());
#else
setuid(0);
uid = geteuid();
debugs(21, 3, "no_suid: PID " << getpid() << " giving up root priveleges forever");
- setuid(0);
+ if (setuid(0) < 0)
+ debugs(50, DBG_IMPORTANT, "WARNING: no_suid: setuid(0): " << xstrerror());
if (setuid(uid) < 0)
- debugs(50, DBG_IMPORTANT, "no_suid: setuid: " << xstrerror());
+ debugs(50, DBG_IMPORTANT, "ERROR: no_suid: setuid(" << uid << "): " << xstrerror());
restoreCapabilities(0);