aboutsummaryrefslogtreecommitdiffstats
path: root/guts/getgroups.c
diff options
context:
space:
mode:
Diffstat (limited to 'guts/getgroups.c')
-rw-r--r--guts/getgroups.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/guts/getgroups.c b/guts/getgroups.c
index 8394325..f952eaf 100644
--- a/guts/getgroups.c
+++ b/guts/getgroups.c
@@ -3,11 +3,15 @@
* wrap_getgroups(int size, gid_t *list) {
* int rc = -1;
*/
+ struct passwd *p = wrap_getpwuid(wrap_getuid());
+ int oldsize = size;
- /* you're only in group zero */
- rc = 1;
- if (size > 0) {
- list[0] = 0;
+ if (p) {
+ rc = wrap_getgrouplist(p->pw_name, wrap_getgid(), list, &size);
+ if (oldsize == 0 || size <= oldsize)
+ rc = size;
+ } else {
+ errno = ENOENT;
}
/* return rc;