diff options
| author | Eric Blake <ebb9@byu.net> | 2009-12-04 08:06:55 -0700 |
|---|---|---|
| committer | Eric Blake <ebb9@byu.net> | 2009-12-04 19:18:06 -0700 |
| commit | 9b4b38f56e854f8f1343fed9dbc225ffbb1d77d4 (patch) | |
| tree | 019ad2a21b62a3ec30eec76b5891c8a749abc377 /src/id.c | |
| parent | tests: fix a bug in sanitize_path_ that inhibited verbose output (diff) | |
| download | coreutils-9b4b38f56e854f8f1343fed9dbc225ffbb1d77d4.tar.gz coreutils-9b4b38f56e854f8f1343fed9dbc225ffbb1d77d4.zip | |
id: handle systems without getgroups support
If getgroups failed with ENOSYS, mgetgroups would unnecessarily
fail, and that provoked id into freeing an uninitialized pointer.
Meanwhile, we were not using xalloc_die properly. Both issues
are better solved in gnulib, by introducing xgetgroups; this
patch uses the new interface.
Regression introduced by commit 6a31fd8d7.
* gnulib: Update, for mgetgroups improvments.
* src/id.c (print_full_info): Adjust caller to die on allocation
failure, and no longer worry about ENOSYS.
* src/group-list.c (print_group_list): Likewise.
* src/setuidgid.c (main): Likewise.
* NEWS: Mention the fix.
* THANKS: Update.
Reported by Scott Harrison.
Diffstat (limited to 'src/id.c')
| -rw-r--r-- | src/id.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -296,9 +296,9 @@ print_full_info (const char *username) gid_t *groups; int i; - int n_groups = mgetgroups (username, (pwd ? pwd->pw_gid : (gid_t) -1), + int n_groups = xgetgroups (username, (pwd ? pwd->pw_gid : (gid_t) -1), &groups); - if (n_groups < 0 && errno != ENOSYS) + if (n_groups < 0) { if (username) { |
