]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: cleanup unused variables
authorKarel Zak <kzak@redhat.com>
Wed, 8 Jun 2011 09:32:53 +0000 (11:32 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 8 Jun 2011 09:32:53 +0000 (11:32 +0200)
login.c: In function ‘main’:
login.c:389:40: warning: variable ‘errsv’ set but not used [-Wunused-but-set-variable]
login.c:389:9: warning: variable ‘ask’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/login.c

index 40f23ad3a01e52a26a9cb281fa26006da5a7e704..74e0cdd15a1c6f863f127127c13bc2abcfe0a3c1 100644 (file)
@@ -386,7 +386,7 @@ main(int argc, char **argv)
     struct group *gr;
     register int ch;
     register char *p;
-    int ask, fflag, hflag, pflag, cnt, errsv;
+    int fflag, hflag, pflag, cnt;
     int quietlog, passwd_req;
     char *domain, *ttyn;
     char tbuf[MAXPATHLEN + 2];
@@ -400,6 +400,7 @@ main(int argc, char **argv)
     struct pam_conv conv = { misc_conv, NULL };
     struct sigaction sa, oldsa_hup, oldsa_term;
 #else
+    int ask;
     char *salt, *pp;
 #endif
 #ifdef LOGIN_CHOWN_VCS
@@ -492,16 +493,20 @@ main(int argc, char **argv)
       }
     argc -= optind;
     argv += optind;
+
+#ifndef HAVE_SECURITY_PAM_MISC_H
+    ask = *argv ? 0 : 1;               /* Do we need ask for login name? */
+#endif
+
     if (*argv) {
        char *p = *argv;
        username = strdup(p);
-       ask = 0;
+
        /* wipe name - some people mistype their password here */
        /* (of course we are too late, but perhaps this helps a little ..) */
        while(*p)
            *p++ = ' ';
-    } else
-        ask = 1;
+    }
 
     for (cnt = getdtablesize(); cnt > 2; cnt--)
       close(cnt);
@@ -1274,8 +1279,6 @@ Michael Riepe <michael@stud.uni-hannover.de>
 
     execvp(childArgv[0], childArgv + 1);
 
-    errsv = errno;
-
     if (!strcmp(childArgv[0], "/bin/sh"))
        warn(_("couldn't exec shell script"));
     else