From def0dc9bcc68bf38170e073990873bb67a7079ad Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sun, 23 Jan 2000 20:18:35 +1100 Subject: [PATCH] - Fix lastlog support, patch from Andre Lucas --- ChangeLog | 1 + login.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74b20e8d6..6f9542086 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ getsockname() requires initialized tolen; andy@guildsoftware.com - AIX patch from Matt Richards and David Rankin + - Fix lastlog support, patch from Andre Lucas 20000122 - Fix compilation of bsd-snprintf.c on Solaris, fix from Ben Taylor diff --git a/login.c b/login.c index f95cbcee8..29259f511 100644 --- a/login.c +++ b/login.c @@ -18,7 +18,7 @@ */ #include "includes.h" -RCSID("$Id: login.c,v 1.18 2000/01/14 04:45:50 damien Exp $"); +RCSID("$Id: login.c,v 1.19 2000/01/23 09:18:36 damien Exp $"); #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) # include @@ -58,20 +58,20 @@ get_last_login_time(uid_t uid, const char *logname, char *lastlog; int fd; #ifdef LASTLOG_IS_DIR - char buf[1024]; + char lbuf[1024]; #endif /* LASTLOG_IS_DIR */ lastlog = _PATH_LASTLOG; buf[0] = '\0'; -#ifdef LASTLOG_IS_DIR +#ifndef LASTLOG_IS_DIR fd = open(lastlog, O_RDONLY); if (fd < 0) return 0; lseek(fd, (off_t) ((long) uid * sizeof(ll)), SEEK_SET); #else /* LASTLOG_IS_DIR */ - snprintf(buf, sizeof(buf), "%s/%s", lastlog, logname); - fd = open(buf, O_RDONLY); + snprintf(lbuf, sizeof(buf), "%s/%s", lastlog, logname); + fd = open(lbuf, O_RDONLY); if (fd < 0) return 0; #endif /* LASTLOG_IS_DIR */