1 --- sysvinit-2.88dsf/src/last.c.wiget 2010-02-19 16:51:36.000000000 +0100
2 +++ sysvinit-2.88dsf/src/last.c 2011-12-03 22:48:11.526513957 +0100
8 + * Try to be smart about the location of the BTMP file
11 +#define _PATH_BTMP "/var/log/btmp"
12 +#define BTMP_FILE _PATH_BTMP
15 +#define TRANSFORM_UTMP_FILE_NAME(file_name) \
16 + ((strcmp (file_name, _PATH_WTMP) == 0 \
17 + && access ( _PATH_WTMP "x", F_OK) == 0) ? (_PATH_WTMP "x") : \
18 + ((strcmp (file_name, _PATH_BTMP) == 0 \
19 + && access ( _PATH_BTMP "x", F_OK) == 0) ? (_PATH_BTMP "x") : \
20 + ((strcmp (file_name, _PATH_WTMP "x") == 0 \
21 + && access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
22 + ((strcmp (file_name, _PATH_BTMP "x") == 0 \
23 + && access (_PATH_BTMP "x", F_OK) != 0) ? _PATH_BTMP : \
27 # define SHUTDOWN_TIME 254
29 @@ -270,28 +270,6 @@ int uread(FILE *fp, struct utmp *u, int
33 - * Try to be smart about the location of the BTMP file
36 -#define BTMP_FILE getbtmp()
39 - static char btmp[PATH_MAX + 5]; /* max path + btmp + null terminator */
42 - memset(btmp, '\0', PATH_MAX + 5);
43 - strncpy(btmp, WTMP_FILE, PATH_MAX);
44 - if ((p = strrchr(btmp, '/')) == NULL)
49 - strcat(btmp, "btmp");
58 @@ -384,6 +382,8 @@ int list(struct utmp *p, time_t t, int w
59 strncat(utline, p->ut_line, UT_LINESIZE);
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]))
67 @@ -666,10 +666,10 @@ int main(int argc, char **argv)
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 --- sysvinit-2.88dsf/src/utmp.c.wiget 2009-11-24 11:03:19.000000000 +0100
81 +++ sysvinit-2.88dsf/src/utmp.c 2011-12-03 22:49:25.353492892 +0100
82 @@ -76,7 +76,9 @@ char *line) /* Which line is this */
83 * this if we have updwtmp() so we can see if the
84 * wtmp file is accessible.
87 if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND)) < 0) return;
92 @@ -160,8 +162,10 @@ char *oldline) /* Line of old utmp ent
94 * Can't do much if UTMP_FILE is not present or not writable.
97 if (access(UTMP_FILE, W_OK) < 0)