]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
silence more compiler warnings
authorSerge Hallyn <shallyn@cisco.com>
Sun, 12 Jan 2020 14:20:50 +0000 (08:20 -0600)
committerSerge Hallyn <shallyn@cisco.com>
Sun, 12 Jan 2020 14:20:50 +0000 (08:20 -0600)
And don't reuse the cp variable for two different purposes.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
src/faillog.c
src/login.c
src/newgrp.c

index 073561c51cb9523fa3debc00e2a649a0bae27bf8..1309dad4f0b89831d6b42054208780a7a580fee0 100644 (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;
 
        /*
index 492021a1359413f1bd519f64df0ce7456dfa7204..00508cd5b9b0f9e7e1d779ef121ac56fa8de9d27 100644 (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;
 
index 2ca5e822e629090d81ccdd36dc827bffb18ffc6f..e3c44e143a1c8f5977d94adc724ff5cd20fabba7 100644 (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: