Building squid failed with a git snapshot of glibc 2.17 on openSUSE
with the following:
pinger.cc: In function 'int main(int, char**)':
pinger.cc:183:21: error: ignoring return value of 'int setgid(__gid_t)', declared with attribute warn_unused_result [-Werror=unused-result]
pinger.cc:184:21: error: ignoring return value of 'int setuid(__uid_t)', declared with attribute warn_unused_result [-Werror=unused-result]
cc1plus: all warnings being treated as errors
And similar with tools.cc.
I've fixed this with the patch below and suggest to apply it,
Andreas
Index: squid-3.2.3/src/icmp/pinger.cc
===================================================================
--- squid-3.2.3.orig/src/icmp/pinger.cc
+++ squid-3.2.3/src/icmp/pinger.cc
@@ -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, 0, "FATAL: pinger: setgid failed.");
+ icmp4.Close();
+ icmp6.Close();
+ exit (1);
+ }
+ if (setuid(getuid()) < 0) {
+ debugs(42, 0, "FATAL: pinger: setuid failed.");
+ icmp4.Close();
+ icmp6.Close();
+ exit (1);
+ }
last_check_time = squid_curtime;
Index: squid-3.2.3/src/tools.cc
===================================================================
--- squid-3.2.3.orig/src/tools.cc
+++ squid-3.2.3/src/tools.cc
@@ -757,7 +757,8 @@ enter_suid(void)
debugs(21, 3, "enter_suid: PID " << getpid() << " taking root priveleges");
#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,7 +783,8 @@ 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, 1, "no_suid: setuid (0): " << xstrerror());
if (setuid(uid) < 0)
debugs(50, 1, "no_suid: setuid: " << xstrerror());
-- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126Received on Sun Nov 18 2012 - 01:16:15 MST
This archive was generated by hypermail 2.2.0 : Sun Nov 18 2012 - 12:00:07 MST