]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Avoid misinterpreting mgetgroups failure in running root-only tests.
authorJim Meyering <meyering@redhat.com>
Wed, 23 Jan 2008 13:12:04 +0000 (14:12 +0100)
committerJim Meyering <meyering@redhat.com>
Sat, 26 Jan 2008 09:04:17 +0000 (10:04 +0100)
* src/setuidgid.c (main): Don't misinterpret as size_t an error
return from mgetgroups.  Reported by Theodoros V. Kalamatianos.

ChangeLog
THANKS
src/setuidgid.c

index 79ec5efd45294f67af8035d78cec424ec4f4b1ad..80be17238b7e0ebfc4529ad21081ea333b217aaa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-01-23  Jim Meyering  <meyering@redhat.com>
 
+       Avoid misinterpreting mgetgroups failure in running root-only tests.
+       * src/setuidgid.c (main): Don't misinterpret as size_t an error
+       return from mgetgroups.  Reported by Theodoros V. Kalamatianos.
+
        * README: Remove/convert a few stray mentions of CVS.
 
 2008-01-22  Jim Meyering  <meyering@redhat.com>
diff --git a/THANKS b/THANKS
index 512149504f818d223c1492e8bfcceb67f127c335..9e4e7e03d05a1346d27cbb725fda90ef8dfc9ef6 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -488,6 +488,7 @@ Tadayoshi Funaba                    tadf@kt.rim.or.jp
 TAKAI Kousuke                       takai@vlsi.kuee.kyoto-u.ac.jp
 Theodore Ts'o                       tytso@rsts-11.mit.edu
 The Wanderer                        inverseparadox@comcast.net
+Theodoros V. Kalamatianos           nyb@users.sourceforge.net
 Thomas Bushnell                     thomas@gnu.ai.mit.edu
 Thomas Goerlich                     thomas@schnappmatik.de
 Thomas Hood                         jdthood@yahoo.co.uk
index 0f551f9cfa34729f6ac9e73bc56d1a86a5b6a530..83369fdef93018ac18e014e72af39deb69995964 100644 (file)
@@ -1,5 +1,5 @@
 /* setuidgid - run a command with the UID and GID of a specified user
-   Copyright (C) 2003-2007 Free Software Foundation, Inc.
+   Copyright (C) 2003-2008 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -181,10 +181,11 @@ main (int argc, char **argv)
 #if HAVE_SETGROUPS
     if (n_gids == 0)
       {
-        n_gids = mgetgroups (pwd->pw_name, pwd->pw_gid, &gids);
-        if (n_gids <= 0)
+        int n = mgetgroups (pwd->pw_name, pwd->pw_gid, &gids);
+        if (n <= 0)
           error (1, errno, _("failed to get groups for user %s"),
                  quote (pwd->pw_name));
+        n_gids = n;
       }
 
     if (setgroups (n_gids, gids))