diff options
| author | ribalba <geerd.dietger.hoffmann@gmail.com> | 2008-03-04 18:03:35 +0100 |
|---|---|---|
| committer | Jim Meyering <meyering@redhat.com> | 2008-03-05 11:38:26 +0100 |
| commit | b7a836c0a3524cda8ef79c30c3fe7ea759ae4656 (patch) | |
| tree | 34130d695817ffefd96218e47e6f4f6780c5cff0 /src/id.c | |
| parent | Now that Makefile.maint is used in VPATH builds, too... (diff) | |
| download | coreutils-b7a836c0a3524cda8ef79c30c3fe7ea759ae4656.tar.gz coreutils-b7a836c0a3524cda8ef79c30c3fe7ea759ae4656.zip | |
Work around AFS bug: id and groups would print invalid group number.
* src/id.c (main): Call print_group_list with a user name, if possible.
* src/groups.c (main): Likewise.
* NEWS: Mention this.
For details, see
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12852
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12875
Signed-off-by: ribalba <geerd.dietger.hoffmann@gmail.com>
Diffstat (limited to 'src/id.c')
| -rw-r--r-- | src/id.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -196,17 +196,22 @@ of a different user")); error (EXIT_FAILURE, 0, _("cannot print only names or real IDs in default format")); + char const *user_name; if (argc - optind == 1) { - struct passwd *pwd = getpwnam (argv[optind]); + struct passwd const *pwd = getpwnam (argv[optind]); if (pwd == NULL) error (EXIT_FAILURE, 0, _("%s: No such user"), argv[optind]); + user_name = argv[optind]; ruid = euid = pwd->pw_uid; rgid = egid = pwd->pw_gid; } else { + struct passwd const *pwd; euid = geteuid (); + pwd = getpwuid (euid); + user_name = pwd ? pwd->pw_name : NULL; ruid = getuid (); egid = getegid (); rgid = getgid (); @@ -223,7 +228,7 @@ of a different user")); } else if (just_group_list) { - if (!print_group_list (argv[optind], ruid, rgid, egid, use_name)) + if (!print_group_list (user_name, ruid, rgid, egid, use_name)) ok = false; } else if (just_context) @@ -232,7 +237,7 @@ of a different user")); } else { - print_full_info (argv[optind]); + print_full_info (user_name); } putchar ('\n'); |
