* src/whoami.c (main): Declare variables where they are used instead of
at the start of the function.
int
main (int argc, char **argv)
{
- struct passwd *pw;
- uid_t uid;
uid_t NO_UID = -1;
initialize_main (&argc, &argv);
}
errno = 0;
- uid = geteuid ();
- pw = uid == NO_UID && errno ? nullptr : getpwuid (uid);
+ uid_t uid = geteuid ();
+ struct passwd *pw = uid == NO_UID && errno ? nullptr : getpwuid (uid);
if (!pw)
error (EXIT_FAILURE, errno, _("cannot find name for user ID %ju"),
(uintmax_t) uid);