summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/getugroups.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/getugroups.c b/lib/getugroups.c
index 0293d27850..d63a6072e4 100644
--- a/lib/getugroups.c
+++ b/lib/getugroups.c
@@ -84,21 +84,21 @@ getugroups (int maxcount, GETGROUPS_T *grouplist, char const *username,
if (maxcount != 0)
{
if (count >= maxcount)
- {
- endgrent ();
- return count;
- }
+ goto done;
grouplist[count] = grp->gr_gid;
}
count++;
if (count < 0)
{
errno = EOVERFLOW;
- return -1;
+ count = -1;
+ goto done;
}
}
}
}
+
+ done:
endgrent ();
return count;