]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/sulogin.c: Make static variables local to main()
authorAlejandro Colomar <alx@kernel.org>
Wed, 17 Jan 2024 15:57:02 +0000 (16:57 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 18 Jan 2024 00:11:19 +0000 (18:11 -0600)
Those variables are only used in main().  Restrict their scope.
Keep them static (.bss), as changing that may be dangerous.

Suggested-by: Samanta Navarro <ferivoz@riseup.net>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/sulogin.c

index f6bb5f6c97f9d7fe3d22a2baf304697ae0b6e1cf..77f4fdde20bc95cbf8a0c96b96a738afa89bd27f 100644 (file)
@@ -37,9 +37,6 @@
  */
 const char *Prog;
 
-static char pass[BUFSIZ];
-
-static struct passwd pwent;
 
 extern char **newenvp;
 extern size_t newenvc;
@@ -58,7 +55,7 @@ static void catch_signals (unused int sig)
        _exit (1);
 }
 
- /*ARGSUSED*/ int main (int argc, char **argv)
+/*ARGSUSED*/ int main (int argc, char **argv)
 {
 #ifndef USE_PAM
        const char *env;
@@ -67,6 +64,9 @@ static void catch_signals (unused int sig)
        TERMIO termio;
        int err = 0;
 
+       static char           pass[BUFSIZ];
+       static struct passwd  pwent;
+
        tcgetattr (0, &termio);
        termio.c_iflag |= (ICRNL | IXON);
        termio.c_oflag |= (CREAD);