** Improvements
+ id and groups work around an AFS-related bug whereby those programs
+ would print an invalid group number, when given no user-name argument.
+
ls --color no longer outputs unnecessary escape sequences
seq gives better diagnostics for invalid formats.
egid = getegid ();
rgid = getgid ();
- if (!print_group_list (NULL, ruid, rgid, egid, true))
+ if (!print_group_list (getlogin (), ruid, rgid, egid, true))
ok = false;
putchar ('\n');
}
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 ();
}
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)
}
else
{
- print_full_info (argv[optind]);
+ print_full_info (user_name);
}
putchar ('\n');