1 diff -ur sysvinit-2.78.orig/src/last.c sysvinit-2.78/src/last.c
2 --- sysvinit-2.78.orig/src/last.c Wed Nov 24 13:24:53 1999
3 +++ sysvinit-2.78/src/last.c Sat Sep 2 01:53:06 2000
9 + * Try to be smart about the location of the BTMP file
12 +#define _PATH_BTMP "/var/log/btmp"
13 +#define BTMP_FILE _PATH_BTMP
16 +#define TRANSFORM_UTMP_FILE_NAME(file_name) \
17 + ((strcmp (file_name, _PATH_WTMP) == 0 \
18 + && access ( _PATH_WTMP "x", F_OK) == 0) ? (_PATH_WTMP "x") : \
19 + ((strcmp (file_name, _PATH_BTMP) == 0 \
20 + && access ( _PATH_BTMP "x", F_OK) == 0) ? (_PATH_BTMP "x") : \
21 + ((strcmp (file_name, _PATH_WTMP "x") == 0 \
22 + && access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
23 + ((strcmp (file_name, _PATH_BTMP "x") == 0 \
24 + && access (_PATH_BTMP "x", F_OK) != 0) ? _PATH_BTMP : \
28 # define SHUTDOWN_TIME 254
34 - * Try to be smart about the location of the BTMP file
37 -#define BTMP_FILE getbtmp()
40 - static char btmp[128];
43 - strcpy(btmp, WTMP_FILE);
44 - if ((p = strrchr(btmp, '/')) == NULL)
49 - strcat(btmp, "btmp");
59 utline[UT_LINESIZE - 1] = 0;
60 if (strncmp(utline, "ftp", 3) == 0 && isdigit(utline[3]))
62 + if (strncmp(utline, "ftpd", 4) == 0 && isdigit(utline[4]))
64 if (strncmp(utline, "uucp", 4) == 0 && isdigit(utline[4]))
68 * Which file do we want to read?
70 if (strcmp(progname, "lastb") == 0) {
72 + ufile = TRANSFORM_UTMP_FILE_NAME(BTMP_FILE);
76 + ufile = TRANSFORM_UTMP_FILE_NAME(WTMP_FILE);
80 diff -ur sysvinit-2.78.orig/src/utmp.c sysvinit-2.78/src/utmp.c
81 --- sysvinit-2.78.orig/src/utmp.c Wed Jun 9 13:11:33 1999
82 +++ sysvinit-2.78/src/utmp.c Sat Sep 2 01:30:44 2000
84 * this if we have updwtmp() so we can see if the
85 * wtmp file is accessible.
88 if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND)) < 0) return;
95 * Can't do much if UTMP_FILE is not present.
98 if (access(UTMP_FILE, F_OK) < 0)