minor compatibility fixes in utmp.h and fixing mismatch with paths.h
authorRich Felker <dalias@aerifal.cx>
Fri, 28 Jun 2013 00:00:29 +0000 (20:00 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 28 Jun 2013 00:00:29 +0000 (20:00 -0400)
the pathnames prefixed with /dev/null/ are guaranteed never to be
valid. the previous use of /dev/null alone was mildly dangerous in
that bad software might attempt to unlink the name when it found a
non-regular file there and create a new file.

include/paths.h
include/utmp.h

index d0a5a6d..e0d1fff 100644 (file)
@@ -27,9 +27,9 @@
 #define        _PATH_SHELLS    "/etc/shells"
 #define        _PATH_TTY       "/dev/tty"
 #define        _PATH_UNIX      "/boot/vmlinux"
 #define        _PATH_SHELLS    "/etc/shells"
 #define        _PATH_TTY       "/dev/tty"
 #define        _PATH_UNIX      "/boot/vmlinux"
-#define _PATH_UTMP     "/var/run/utmp"
+#define _PATH_UTMP     "/dev/null/utmp"
 #define        _PATH_VI        "/usr/bin/vi"
 #define        _PATH_VI        "/usr/bin/vi"
-#define _PATH_WTMP     "/var/log/wtmp"
+#define _PATH_WTMP     "/dev/null/wtmp"
 #define _PATH_LASTLOG   "/var/log/lastlog"
 
 #define        _PATH_DEV       "/dev/"
 #define _PATH_LASTLOG   "/var/log/lastlog"
 
 #define        _PATH_DEV       "/dev/"
index c24d0a8..b357ac8 100644 (file)
@@ -19,6 +19,7 @@ struct lastlog {
 
 #define ut_time ut_tv.tv_sec
 #define ut_name ut_user
 
 #define ut_time ut_tv.tv_sec
 #define ut_name ut_user
+#define ut_addr ut_addr_v6[0]
 #define utmp utmpx
 #define utmpname(x) (-1)
 
 #define utmp utmpx
 #define utmpname(x) (-1)
 
@@ -31,8 +32,13 @@ void         setutent(void);
 
 void updwtmp(const char *, const struct utmp *);
 
 
 void updwtmp(const char *, const struct utmp *);
 
-#define _PATH_UTMP "/dev/null"
-#define _PATH_WTMP "/dev/null"
+#define _PATH_UTMP "/dev/null/utmp"
+#define _PATH_WTMP "/dev/null/wtmp"
+
+#define UTMP_FILE _PATH_UTMP
+#define WTMP_FILE _PATH_WTMP
+#define UTMP_FILENAME _PATH_UTMP
+#define WTMP_FILENAME _PATH_WTMP
 
 #ifdef __cplusplus
 }
 
 #ifdef __cplusplus
 }