blob: f267875ed8c24a276ef29544ef72af38212e48e5 [file] [log] [blame]
From 86dae8010310d13bd2a2beb006b4085d06ae1556 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 25 Jun 2017 00:59:24 -0700
Subject: [PATCH] tools.cc: fixed unused-result warning
fix
| ../../squid-3.5.26/src/tools.cc: In function 'void enter_suid()':
| ../../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]
| setuid(0);
| ~~~~~~^~~
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/tools.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/tools.cc b/src/tools.cc
index 5829574..19f0836 100644
--- a/src/tools.cc
+++ b/src/tools.cc
@@ -581,8 +581,10 @@ enter_suid(void)
debugs (21, 3, "enter_suid: setresuid failed: " << xstrerr(xerrno));
}
#else
-
- setuid(0);
+ if (setuid(0) < 0) {
+ const auto xerrno = errno;
+ debugs(50, DBG_IMPORTANT, "WARNING: no_suid: setuid(0): " << xstrerr(xerrno));
+ }
#endif
#if HAVE_PRCTL && defined(PR_SET_DUMPABLE)
/* Set Linux DUMPABLE flag */