blob: 8ea55d0e165cb223506890efbe970068af4bbee6 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From faaa796a138cbd5033b1e53f33faac0cf4162bf5 Mon Sep 17 00:00:00 2001
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 25 Jun 2017 00:59:24 -0700
4Subject: [PATCH] tools.cc: fixed unused-result warning
5
6fix
7| ../../squid-3.5.26/src/tools.cc: In function 'void enter_suid()':
8| ../../squid-3.5.26/src/tools.cc:616:11: error: ignoring return value of 'int setuid(__uid_t)', declared with attribute warn_unused_result [-Werror=unused-result]
9| setuid(0);
10| ~~~~~~^~~
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050013
Brad Bishop316dfdd2018-06-25 12:45:53 -040014---
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015 src/tools.cc | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/src/tools.cc b/src/tools.cc
19index 8137a03..843e266 100644
20--- a/src/tools.cc
21+++ b/src/tools.cc
22@@ -612,8 +612,8 @@ enter_suid(void)
23 if (setresuid((uid_t)-1, 0, (uid_t)-1) < 0)
24 debugs (21, 3, "enter_suid: setresuid failed: " << xstrerror ());
25 #else
26-
27- setuid(0);
28+ if (setuid(0) < 0)
29+ debugs(50, DBG_IMPORTANT, "WARNING: no_suid: setuid(0): " << xstrerror());
30 #endif
31 #if HAVE_PRCTL && defined(PR_SET_DUMPABLE)
32 /* Set Linux DUMPABLE flag */