summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-05-06 14:43:31 +0000
committerJim Meyering <jim@meyering.net>2004-05-06 14:43:31 +0000
commit76ef73f50a23ed943f9372f6dcb194eb9c855fed (patch)
tree6cbd9382818cd6cd8e3c3de17a61b0c96f3e5a73
parent782b73c51431bb4f3b549d1ffbfe7ac05551bf2a (diff)
downloadcoreutils-76ef73f50a23ed943f9372f6dcb194eb9c855fed.tar.xz
(xgetgroups): Use xnmalloc, rather than xmalloc.
Don't add `1' to the buffer size (it was to protect against malloc implementations that fail to allocate a buffer of size zero). That is no longer necessary, since we use a malloc wrapper on such systems.
-rw-r--r--src/id.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/id.c b/src/id.c
index db4883c83..0fec74fe2 100644
--- a/src/id.c
+++ b/src/id.c
@@ -261,8 +261,7 @@ xgetgroups (const char *username, gid_t gid, int *n_groups,
else
max_n_groups = getugroups (0, NULL, username, gid);
- /* Add 1 just in case max_n_groups is zero. */
- g = xmalloc (max_n_groups * sizeof (GETGROUPS_T) + 1);
+ g = xnmalloc (max_n_groups, sizeof (GETGROUPS_T));
if (username == 0)
ng = getgroups (max_n_groups, g);
else