From 300437197350ee4eb6d5f75b3cb8c35a7b9f29ed Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 8 Jul 2021 03:25:48 +0000 Subject: [PATCH] Fix build on Ubuntu 21 (#855) The `-Wunused-result` warning for setuid(0) call was observed on Ubuntu 21.04 (when cross compiling Squid for Ubuntu 21.10). Signed-off-by: Heinrich Schuchardt --- src/tools.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools.cc b/src/tools.cc index b0fb52ff67..00d77cc4c1 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -582,7 +582,10 @@ enter_suid(void) } #else - setuid(0); + if (setuid(0) < 0) { + const auto xerrno = errno; + debugs(21, 3, "setuid(0) failed: " << xstrerr(xerrno)); + } #endif #if HAVE_PRCTL && defined(PR_SET_DUMPABLE) /* Set Linux DUMPABLE flag */ -- 2.47.2