[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
getugroups: always close the group DB
From: |
Jim Meyering |
Subject: |
getugroups: always close the group DB |
Date: |
Thu, 05 Jul 2007 09:47:20 +0200 |
I doubt this would ever be triggered, (a user belonging to 2^31 groups
is unlikely, to say the least), but I'm fixing it regardless:
Close the group DB even when failing with 2^31 or more members.
* lib/getugroups.c (getugroups): Don't return without calling endgrent.
Index: lib/getugroups.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getugroups.c,v
retrieving revision 1.18
diff -u -p -r1.18 getugroups.c
--- lib/getugroups.c 4 Jul 2007 21:46:45 -0000 1.18
+++ lib/getugroups.c 5 Jul 2007 07:27:53 -0000
@@ -84,21 +84,21 @@ getugroups (int maxcount, GETGROUPS_T *g
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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- getugroups: always close the group DB,
Jim Meyering <=