]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix build on Ubuntu 21 (#855)
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 8 Jul 2021 03:25:48 +0000 (03:25 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Thu, 29 Jul 2021 09:33:00 +0000 (21:33 +1200)
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 <heinrich.schuchardt@canonical.com>
src/tools.cc

index 83f97b5f70d5be0d1025e1a8ffb4394c50e14cf1..2c9e8ca250af0d3c082e854d947882f831921333 100644 (file)
@@ -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 */