[Pkg-shadow-commits] r2832 - in upstream/trunk: . src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Tue Apr 28 19:25:15 UTC 2009
Author: nekral-guest
Date: 2009-04-28 19:25:15 +0000 (Tue, 28 Apr 2009)
New Revision: 2832
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/lastlog.c
Log:
* src/lastlog.c: Replace atoi() by getulong().
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2009-04-28 19:19:33 UTC (rev 2831)
+++ upstream/trunk/ChangeLog 2009-04-28 19:25:15 UTC (rev 2832)
@@ -1,5 +1,9 @@
2009-04-28 Nicolas François <nicolas.francois at centraliens.net>
+ * src/lastlog.c: Replace atoi() by getulong().
+
+2009-04-28 Nicolas François <nicolas.francois at centraliens.net>
+
* libmisc/failure.h: Replace HAVE_UTMPX_H by USE_UTMPX.
2009-04-28 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/src/lastlog.c
===================================================================
--- upstream/trunk/src/lastlog.c 2009-04-28 19:19:33 UTC (rev 2831)
+++ upstream/trunk/src/lastlog.c 2009-04-28 19:25:15 UTC (rev 2832)
@@ -60,9 +60,7 @@
static bool has_umin = false;
static unsigned long umax; /* if uflg and has_umax, only display users with uid <= umax */
static bool has_umax = false;
-static int days; /* number of days to consider for print command */
static time_t seconds; /* that number of days in seconds */
-static int inverse_days; /* number of days to consider for print command */
static time_t inverse_seconds; /* that number of days in seconds */
static struct stat statbuf; /* fstat buffer for file size */
@@ -213,15 +211,31 @@
usage ();
break;
case 't':
- days = atoi (optarg); /* FIXME */
+ {
+ unsigned long days;
+ if (getulong (optarg, &days) == 0) {
+ fprintf (stderr,
+ _("%s: invalid numeric argument '%s'\n"),
+ "lastlog", optarg);
+ exit (EXIT_FAILURE);
+ }
seconds = (time_t) days * DAY;
tflg = true;
break;
+ }
case 'b':
- inverse_days = atoi (optarg); /* FIXME */
+ {
+ unsigned long inverse_days;
+ if (getulong (optarg, &inverse_days) == 0) {
+ fprintf (stderr,
+ _("%s: invalid numeric argument '%s'\n"),
+ "lastlog", optarg);
+ exit (EXIT_FAILURE);
+ }
inverse_seconds = (time_t) inverse_days * DAY;
bflg = true;
break;
+ }
case 'u':
{
const struct passwd *pwent;
More information about the Pkg-shadow-commits
mailing list