summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-01-23 20:18:35 +1100
committerDamien Miller <djm@mindrot.org>2000-01-23 20:18:35 +1100
commitdef0dc9bcc68bf38170e073990873bb67a7079ad (patch)
tree12a5134f0a61dcad4a7503da0d416e63f27eb354
parent641a63f7a34ce60420768c3cdb107055241df87a (diff)
- Fix lastlog support, patch from Andre Lucas <andre.lucas@dial.pipex.com>
-rw-r--r--ChangeLog1
-rw-r--r--login.c10
2 files changed, 6 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 74b20e8d..6f954208 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
getsockname() requires initialized tolen; andy@guildsoftware.com
- AIX patch from Matt Richards <v2matt@btv.ibm.com> and David Rankin
<drankin@bohemians.lexington.ky.us>
+ - Fix lastlog support, patch from Andre Lucas <andre.lucas@dial.pipex.com>
20000122
- Fix compilation of bsd-snprintf.c on Solaris, fix from Ben Taylor
diff --git a/login.c b/login.c
index f95cbcee..29259f51 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 <utmpx.h>
@@ -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 */