silence more compiler warnings

And don't reuse the cp variable for two different purposes.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
This commit is contained in:
Serge Hallyn 2020-01-12 08:20:50 -06:00
parent 93f1f35123
commit ed4a0157c4
3 changed files with 6 additions and 5 deletions

View File

@ -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;
/*

View File

@ -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;

View File

@ -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: