- Fix lastlog support, patch from Andre Lucas <andre.lucas@dial.pipex.com>
diff --git a/ChangeLog b/ChangeLog
index 74b20e8..6f95420 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 f95cbce..29259f5 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 @@
 	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 */