]> granicus.if.org Git - shadow/commitdiff
* src/lastlog.c: Remove statbuf, not used.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 1 Jan 2008 14:38:47 +0000 (14:38 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 1 Jan 2008 14:38:47 +0000 (14:38 +0000)
* src/lastlog.c: Fix types, cast umin and umax to uid_t.
* src/lastlog.c: (option -u) user needs to be a signed long, not
  uid_t (to accept rangees like -<uid>

ChangeLog
src/lastlog.c

index aeb2e8d09ae51819f63a04d70266866e20219316..cc9b1b84fa58c54191eb6511f51281ee0545d388 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-01  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/lastlog.c: Remove statbuf, not used.
+       * src/lastlog.c: Fix types, cast umin and umax to uid_t.
+       * src/lastlog.c: (option -u) user needs to be a signed long, not
+       uid_t (to accept rangees like -<uid>
+
 2008-01-01  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/useradd.c: Avoid ?: construct without the middle term.
index 449012b057db2c5c09a1438623a5a39bb9414515..361af907082894cf913f5cb68fb1444708d39501 100644 (file)
@@ -62,7 +62,6 @@ static int uflg = 0;          /* print only an user of range of users */
 static int tflg = 0;           /* print is restricted to most recent days */
 static int bflg = 0;           /* print excludes most recent days */
 static struct lastlog lastlog; /* scratch structure to play with ... */
-static struct stat statbuf;    /* fstat buffer for file size */
 static struct passwd *pwent;
 
 #define        NOW     (time ((time_t *) 0))
@@ -133,8 +132,8 @@ static void print (void)
        while ((pwent = getpwent ())) {
                user = pwent->pw_uid;
                if (uflg &&
-                   ((umin != -1 && user < umin) ||
-                    (umax != -1 && user > umax)))
+                   ((umin != -1 && user < (uid_t)umin) ||
+                    (umax != -1 && user > (uid_t)umax)))
                        continue;
                offset = user * sizeof lastlog;
 
@@ -201,7 +200,8 @@ int main (int argc, char **argv)
                                        umax = umin;
                                } else {
                                        char *endptr = NULL;
-                                       uid_t user = strtol(optarg, &endptr, 10);
+                                       long int user;
+                                       user = strtol(optarg, &endptr, 10);
                                        if (*optarg != '\0' && *endptr == '\0') {
                                                if (user < 0) {
                                                        /* -<userid> */