[Pkg-shadow-commits] r2827 - in upstream/trunk: . libmisc

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Tue Apr 28 19:12:48 UTC 2009


Author: nekral-guest
Date: 2009-04-28 19:12:48 +0000 (Tue, 28 Apr 2009)
New Revision: 2827

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/libmisc/limits.c
Log:
	* libmisc/limits.c: Replace strtol() by getlong().
	* libmisc/limits.c: Replace HAVE_UTMPX_H by USE_UTMPX.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2009-04-27 20:29:43 UTC (rev 2826)
+++ upstream/trunk/ChangeLog	2009-04-28 19:12:48 UTC (rev 2827)
@@ -1,5 +1,10 @@
 2009-04-27  Nicolas François  <nicolas.francois at 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 at centraliens.net>
+
 	* man/groupmod.8.xml, man/usermod.8.xml, man/groupadd.8.xml,
 	man/useradd.8.xml: Added note to warn about insecurity in using
 	--password.

Modified: upstream/trunk/libmisc/limits.c
===================================================================
--- upstream/trunk/libmisc/limits.c	2009-04-27 20:29:43 UTC (rev 2826)
+++ upstream/trunk/libmisc/limits.c	2009-04-28 19:12:48 UTC (rev 2827)
@@ -89,14 +89,13 @@
 
 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 @@
 /* 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 @@
 	}
 
 	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 @@
 			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.




More information about the Pkg-shadow-commits mailing list