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

index 1bbefdd12265101fedd0c6704fdc863be5871973..ee13f7a537ad7cb47b036cf28697070f0cea5f50 100644 (file)
@@ -180,8 +180,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 ce6f742873f67ce08a846bc517383d49148025c8..c3f0f59fc60ac72abd8329d8d0d691ce6807bb2f 100644 (file)
@@ -754,10 +754,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);
@@ -782,10 +782,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, 1, "no_suid: setuid: " << xstrerror());
+        debugs(50, DBG_IMPORTANT, "ERROR: no_suid: setuid(" << uid << "): " << xstrerror());
 
     restoreCapabilities(0);