]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix OpenSUSE glibc 2.17 compile issues
authorAndreas Jaeger <aj@suse.com>
Sat, 24 Nov 2012 03:51:51 +0000 (20:51 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 24 Nov 2012 03:51:51 +0000 (20:51 -0700)
src/icmp/pinger.cc
src/tools.cc

index 3151ab55c47d6193438065b077c22df1dd87e101..55754ef00db49d533ab54d431496b54a1869376e 100644 (file)
@@ -179,8 +179,18 @@ main(int argc, char *argv[])
     }
     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;
 
index 61706628317ac6456d9e50ca1699166a04282089..95e7ce6e13dfbf4d4cb4a4d0faad21228e664941 100644 (file)
@@ -663,10 +663,10 @@ leave_suid(void)
 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);
@@ -691,10 +691,11 @@ no_suid(void)
     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);