X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgetugroups.c;h=8605ab1a1bdf3703b1ea64ca65606d725d7c3f57;hb=e29e19dce9e19be76fae92b0955d02c843333093;hp=2207b85a176f1fdd24fc852203e09a2f875b53d5;hpb=1203e8d1f62dec3d2436dffadd5c20793cf84366;p=gnulib.git diff --git a/lib/getugroups.c b/lib/getugroups.c index 2207b85a1..8605ab1a1 100644 --- a/lib/getugroups.c +++ b/lib/getugroups.c @@ -21,22 +21,31 @@ #include "getugroups.h" +#include #include #include /* grp.h on alpha OSF1 V2.0 uses "FILE *". */ -#include - +#include #include -#include +#if !HAVE_GRP_H -/* 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 (void); +/* Mingw lacks all things related to group management. The best we + can do is fail with ENOSYS. */ -#include +int +getugroups (int maxcount _UNUSED_PARAMETER_, + gid_t *grouplist _UNUSED_PARAMETER_, + char const *username _UNUSED_PARAMETER_, + gid_t gid _UNUSED_PARAMETER_) +{ + errno = ENOSYS; + return -1; +} -#define STREQ(s1, s2) (strcmp (s1, s2) == 0) +#else /* HAVE_GRP_H */ +# include + +# define STREQ(s1, s2) (strcmp (s1, s2) == 0) /* Like `getgroups', but for user USERNAME instead of for the current process. Store at most MAXCOUNT group IDs in the GROUPLIST array. @@ -46,7 +55,7 @@ struct group *getgrent (void); Otherwise, return the number of IDs we've written into GROUPLIST. */ int -getugroups (int maxcount, GETGROUPS_T *grouplist, char const *username, +getugroups (int maxcount, gid_t *grouplist, char const *username, gid_t gid) { int count = 0; @@ -112,3 +121,5 @@ getugroups (int maxcount, GETGROUPS_T *grouplist, char const *username, return count; } + +#endif /* HAVE_GRP_H */