]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/sulogin.c: Remove 'static' from local variable, but keep initialization
authorAlejandro Colomar <alx@kernel.org>
Wed, 17 Jan 2024 16:08:50 +0000 (17:08 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 18 Jan 2024 00:11:19 +0000 (18:11 -0600)
We don't need 'static', because it's in main(), which is only called
once.  However, we will need initialization as if it were 'static', so
use ={} to initialize it.  This will allow freeing the pointers before
they have been allocated.

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

index aa588c3dbe50bf73fac17107f34b809a72127c71..ab2dcf9415c1492317617caf9a135c17eb5f3687 100644 (file)
@@ -55,17 +55,19 @@ static void catch_signals (unused int sig)
        _exit (1);
 }
 
-/*ARGSUSED*/ int main (int argc, char **argv)
+
+/*ARGSUSED*/ int
+main(int argc, char **argv)
 {
        int            err = 0;
        char           pass[BUFSIZ];
        char           **envp = environ;
        TERMIO         termio;
+       struct passwd  pwent = {};
 #ifndef USE_PAM
        const char     *env;
 #endif
 
-       static struct passwd  pwent;
 
        tcgetattr (0, &termio);
        termio.c_iflag |= (ICRNL | IXON);