X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgetugroups.c;h=b266bb8c320108144069dcc1066c007224da52bf;hb=e8e63d1b31bca6c82713cba490b21a861abb24b5;hp=6c557cdf341fa55c5d9c2e338a4f3910a34b9552;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/getugroups.c b/lib/getugroups.c index 6c557cdf3..b266bb8c3 100644 --- a/lib/getugroups.c +++ b/lib/getugroups.c @@ -1,6 +1,6 @@ /* getugroups.c -- return a list of the groups a user is in - Copyright (C) 1990, 1991, 1998-2000, 2003-2007 Free Software Foundation. + Copyright (C) 1990, 1991, 1998-2000, 2003-2008 Free Software Foundation. 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 @@ -21,20 +21,18 @@ #include "getugroups.h" +#include #include /* grp.h on alpha OSF1 V2.0 uses "FILE *". */ #include #include #include -#ifndef EOVERFLOW -# define EOVERFLOW EINVAL -#endif /* Some old header files might not declare setgrent, getgrent, and endgrent. If you don't have them at all, we can't implement this function. You lose! */ -struct group *getgrent (); +struct group *getgrent (void); #include @@ -92,12 +90,12 @@ getugroups (int maxcount, GETGROUPS_T *grouplist, char const *username, goto done; grouplist[count] = grp->gr_gid; } - count++; - if (count < 0) + if (count == INT_MAX) { errno = EOVERFLOW; goto done; } + count++; } } }