* 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>
This commit is contained in:
nekral-guest 2008-01-01 14:38:47 +00:00
parent d0de685c7a
commit 09a95ed70a
2 changed files with 11 additions and 4 deletions

View File

@ -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.

View 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> */