From: Collin Funk Date: Sun, 7 Dec 2025 22:59:19 +0000 (-0800) Subject: maint: logname: reduce variable scope X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efd9a48ca508879a8b286d3b96118c3fb4942914;p=thirdparty%2Fcoreutils.git maint: logname: reduce variable scope * src/logname.c (main): Declare variables where they are used instead of at the start of the function. --- diff --git a/src/logname.c b/src/logname.c index 5a725e448a..0bdf298fb9 100644 --- a/src/logname.c +++ b/src/logname.c @@ -49,8 +49,6 @@ Print the user's login name.\n\ int main (int argc, char **argv) { - char *cp; - initialize_main (&argc, &argv); set_program_name (argv[0]); setlocale (LC_ALL, ""); @@ -71,7 +69,7 @@ main (int argc, char **argv) /* POSIX requires using getlogin (or equivalent code) and prohibits using a fallback technique. */ - cp = getlogin (); + char const *cp = getlogin (); if (! cp) error (EXIT_FAILURE, 0, _("no login name"));