]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
chroot: always diagnose failure to set supplemental groups
authorPádraig Brady <P@draigBrady.com>
Thu, 13 Mar 2014 01:32:46 +0000 (01:32 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 19 Mar 2014 02:41:24 +0000 (02:41 +0000)
* src/chroot.c (setgroups): Change this replacement to
fail when called so that platforms like Interix without support for
supplemental groups don't silently ignore a --groups option.

src/chroot.c

index 36912a5d357eb8e01a880570e90c6592de520538..8b08b84ea196adaf77ecb3cd7cfce28b85e30132 100644 (file)
@@ -54,13 +54,12 @@ static struct option const long_opts[] =
 };
 
 #if ! HAVE_SETGROUPS
-/* At least Interix lacks supplemental group support.  Define an
-   always-successful replacement to avoid checking for setgroups
-   availability everywhere, just to support broken platforms. */
+/* At least Interix lacks supplemental group support.  */
 static int
 setgroups (size_t size _GL_UNUSED, gid_t const *list _GL_UNUSED)
 {
-  return 0;
+  errno = ENOTSUP;
+  return -1;
 }
 #endif