]> granicus.if.org Git - shadow/commitdiff
* libmisc/limits.c: Replace strtol() by getlong().
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 28 Apr 2009 19:12:48 +0000 (19:12 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 28 Apr 2009 19:12:48 +0000 (19:12 +0000)
* libmisc/limits.c: Replace HAVE_UTMPX_H by USE_UTMPX.

ChangeLog
libmisc/limits.c

index 3051169e191a5cdc0d592d3bdc46617b29734fa3..909c99b14f9486de5c2a943502f2be880c8698f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-27  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/limits.c: Replace strtol() by getlong().
+       * libmisc/limits.c: Replace HAVE_UTMPX_H by USE_UTMPX.
+
 2009-04-27  Nicolas François  <nicolas.francois@centraliens.net>
 
        * man/groupmod.8.xml, man/usermod.8.xml, man/groupadd.8.xml,
index a6d8df7ab2948e882d0089e6e02d5a31c3865329..c25c5f02ecc9e525307b6d40f4ab1ac8857b48c7 100644 (file)
@@ -89,14 +89,13 @@ setrlimit_value (unsigned int resource, const char *value,
 
 static int set_prio (const char *value)
 {
-       int prio;
-       char **endptr = (char **) &value;
+       long prio;
 
-       prio = strtol (value, endptr, 10);
-       if ((0 == prio) && (value == *endptr)) {
+       if (   (getlong (value, &prio) == 0)
+           || (prio != (int) prio)) {
                return 0;
        }
-       if (setpriority (PRIO_PROCESS, 0, prio) != 0) {
+       if (setpriority (PRIO_PROCESS, 0, (int) prio) != 0) {
                return LOGIN_ERROR_RLIMIT;
        }
        return 0;
@@ -120,11 +119,11 @@ static int set_umask (const char *value)
 /* Counts the number of user logins and check against the limit */
 static int check_logins (const char *name, const char *maxlogins)
 {
-#if HAVE_UTMPX_H
+#ifdef USE_UTMPX
        struct utmpx *ut;
-#else
+#else                          /* !USE_UTMPX */
        struct utmp *ut;
-#endif
+#endif                         /* !USE_UTMPX */
        unsigned long limit, count;
 
        if (getulong (maxlogins, &limit) == 0) {
@@ -137,13 +136,13 @@ static int check_logins (const char *name, const char *maxlogins)
        }
 
        count = 0;
-#if HAVE_UTMPX_H
+#ifdef USE_UTMPX
        setutxent ();
        while ((ut = getutxent ())) {
-#else
+#else                          /* !USE_UTMPX */
        setutent ();
        while ((ut = getutent ())) {
-#endif
+#endif                         /* !USE_UTMPX */
                if (USER_PROCESS != ut->ut_type) {
                        continue;
                }
@@ -158,11 +157,11 @@ static int check_logins (const char *name, const char *maxlogins)
                        break;
                }
        }
-#if HAVE_UTMPX_H
+#ifdef USE_UTMPX
        endutxent ();
-#else
+#else                          /* !USE_UTMPX */
        endutent ();
-#endif
+#endif                         /* !USE_UTMPX */
        /*
         * This is called after setutmp(), so the number of logins counted
         * includes the user who is currently trying to log in.