From: Alejandro Colomar Date: Wed, 17 Jan 2024 16:08:50 +0000 (+0100) Subject: src/sulogin.c: Remove 'static' from local variable, but keep initialization X-Git-Tag: 4.15.0-rc1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08ae7af111aaf8eb399b6ca2d473f4fc0c353dc6;p=thirdparty%2Fshadow.git src/sulogin.c: Remove 'static' from local variable, but keep initialization 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 Suggested-by: Serge Hallyn Signed-off-by: Alejandro Colomar --- diff --git a/src/sulogin.c b/src/sulogin.c index aa588c3db..ab2dcf941 100644 --- a/src/sulogin.c +++ b/src/sulogin.c @@ -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);