]> granicus.if.org Git - shadow/commitdiff
* src/login.c: timeout, delay, and retries should be unsigned.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 22 Apr 2009 20:15:21 +0000 (20:15 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 22 Apr 2009 20:15:21 +0000 (20:15 +0000)
* src/login.c: Ignore the return value of alarm() and sleep().

ChangeLog
src/login.c

index 6fcbd8fff4dd990f106fd9b5582c209dedf99330..99879cf26bb08cecb7be5380841ea68548033362 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-22  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/login.c: timeout, delay, and retries should be unsigned.
+       * src/login.c: Ignore the return value of alarm() and sleep().
+
 2009-04-22  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/login.c: If we cannot get the terminal configuration, do not
index 3791a0cf34cab1455fd9b2760814f3b858f5c6f8..29de519c61d4c8ce335bb13aa83c57ba09652d0a 100644 (file)
@@ -101,7 +101,7 @@ static bool hflg = false;
 static bool preauth_flag = false;
 
 static bool amroot;
-static int timeout;
+static unsigned int timeout;
 
 /*
  * External identifiers.
@@ -413,7 +413,7 @@ static void init_env (void)
 
 static RETSIGTYPE alarm_handler (unused int sig)
 {
-       fprintf (stderr, _("\nLogin timed out after %d seconds.\n"), timeout);
+       fprintf (stderr, _("\nLogin timed out after %u seconds.\n"), timeout);
        exit (0);
 }
 
@@ -522,8 +522,8 @@ int main (int argc, char **argv)
 #if defined(HAVE_STRFTIME) && !defined(USE_PAM)
        char ptime[80];
 #endif
-       int delay;
-       int retries;
+       unsigned int delay;
+       unsigned int retries;
        bool failed;
        bool subroot = false;
 #ifndef USE_PAM
@@ -695,14 +695,14 @@ int main (int argc, char **argv)
       top:
        /* only allow ALARM sec. for login */
        (void) signal (SIGALRM, alarm_handler);
-       timeout = getdef_num ("LOGIN_TIMEOUT", ALARM);
+       timeout = getdef_unum ("LOGIN_TIMEOUT", ALARM);
        if (timeout > 0) {
-               alarm (timeout);
+               (void) alarm (timeout);
        }
 
        environ = newenvp;      /* make new environment active */
-       delay = getdef_num ("FAIL_DELAY", 1);
-       retries = getdef_num ("LOGIN_RETRIES", RETRIES);
+       delay   = getdef_unum ("FAIL_DELAY", 1);
+       retries = getdef_unum ("LOGIN_RETRIES", RETRIES);
 
 #ifdef USE_PAM
        retcode = pam_start ("login", username, &conv, &pamh);
@@ -847,7 +847,7 @@ int main (int argc, char **argv)
                }
 
                /* We don't get here unless they were authenticated above */
-               alarm (0);
+               (void) alarm (0);
        }
 
        /* Check the account validity */
@@ -1065,7 +1065,7 @@ int main (int argc, char **argv)
                 * before the sleep() below completes, login will exit.
                 */
                if (delay > 0) {
-                       sleep (delay);
+                       (void) sleep (delay);
                }
 
                puts (_("Login incorrect"));
@@ -1078,7 +1078,7 @@ int main (int argc, char **argv)
        }                       /* while (true) */
 #endif                         /* ! USE_PAM */
 
-       alarm (0);              /* turn off alarm clock */
+       (void) alarm (0);               /* turn off alarm clock */
 
 #ifndef USE_PAM                        /* PAM does this */
        /*