Hurd: account for setgroups() being callable unprivileged
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 6 Jan 2020 13:46:54 +0000 (13:46 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Mon, 6 Jan 2020 14:33:10 +0000 (14:33 +0000)
src/src/exim.c

index 3fda22232b6d2ba6e93c36cca4b4d53bd7ef92f3..af4b525591c6140988e9773107d24bc404656c69 100644 (file)
@@ -3641,15 +3641,15 @@ an error return. The following code should cope with both types of system.
  in the call to exim_setugid().
 
 However, if this process isn't running as root, setgroups() can't be used
-since you have to be root to run it, even if throwing away groups. Not being
-root here happens only in some unusual configurations. We just ignore the
-error. */
+since you have to be root to run it, even if throwing away groups.
+Except, sigh, for Hurd - where you can.
+Not being root here happens only in some unusual configurations. */
 
-if (
+if (  !unprivileged
 #ifndef OS_SETGROUPS_ZERO_DROPS_ALL
-   setgroups(0, NULL) != 0 &&
+   && setgroups(0, NULL) != 0
 #endif
-   setgroups(1, group_list) != 0 && !unprivileged)
+   && setgroups(1, group_list) != 0)
   exim_fail("exim: setgroups() failed: %s\n", strerror(errno));
 
 /* If the configuration file name has been altered by an argument on the