From ed4a0157c4db32d58fec5ebed3ace9902899f981 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Sun, 12 Jan 2020 08:20:50 -0600 Subject: [PATCH] silence more compiler warnings And don't reuse the cp variable for two different purposes. Signed-off-by: Serge Hallyn --- src/faillog.c | 2 +- src/login.c | 4 ++-- src/newgrp.c | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/faillog.c b/src/faillog.c index 073561c5..1309dad4 100644 --- a/src/faillog.c +++ b/src/faillog.c @@ -561,7 +561,7 @@ static void set_locktime (long locktime) int main (int argc, char **argv) { long fail_locktime; - short fail_max; + short fail_max = 0; // initialize to silence compiler warning long days; /* diff --git a/src/login.c b/src/login.c index 492021a1..00508cd5 100644 --- a/src/login.c +++ b/src/login.c @@ -235,7 +235,7 @@ static void bad_time_notify (void) static void check_nologin (bool login_to_root) { - char *fname; + const char *fname; /* * Check to see if system is turned off for non-root users. @@ -375,7 +375,7 @@ static void process_flags (int argc, char *const *argv) static void init_env (void) { #ifndef USE_PAM - char *cp; + const char *cp; #endif char *tmp; diff --git a/src/newgrp.c b/src/newgrp.c index 2ca5e822..e3c44e14 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -400,6 +400,7 @@ int main (int argc, char **argv) int err = 0; gid_t gid; char *cp; + char *progbase; const char *name, *prog; char *group = NULL; char *command = NULL; @@ -806,7 +807,7 @@ int main (int argc, char **argv) * Now I try to find the basename of the login shell. This will * become argv[0] of the spawned command. */ - cp = Basename ((char *) prog); + progbase = (char *) Basename ((char *) prog); /* * Switch back to her home directory if i am doing login @@ -844,7 +845,7 @@ int main (int argc, char **argv) * Exec the login shell and go away. We are trying to get back to * the previous environment which should be the user's login shell. */ - err = shell (prog, initflag ? (char *) 0 : cp, newenvp); + err = shell (prog, initflag ? (char *) 0 : progbase, newenvp); exit ((err == ENOENT) ? E_CMD_NOTFOUND : E_CMD_NOEXEC); /*@notreached@*/ failure: