From eee76e42f32f90af4e64a254810fcb767297fecf Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 24 Mar 2015 00:11:15 +0100 Subject: libc: TIME64_COMPAT32 for sparc, mips Signed-off-by: Bernhard Reutner-Fischer --- libutil/logwtmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libutil/logwtmp.c') diff --git a/libutil/logwtmp.c b/libutil/logwtmp.c index 2a6f28a48..6a53b5ff1 100644 --- a/libutil/logwtmp.c +++ b/libutil/logwtmp.c @@ -23,7 +23,7 @@ void logwtmp(const char *line, const char *name, const char *host) strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); -#if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0 +#if !defined __WORDSIZE_TIME64_COMPAT32 gettimeofday(&lutmp.ut_tv, NULL); #else { -- cgit v1.2.3 From 6ff9c31abc14f207265ab214370982ecb3bfe428 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 25 Mar 2015 23:59:45 +0100 Subject: utmp: favour POSIX utmpx over SVID utmp Note: _PATH_UTMPX == _PATH_UTMP and the utmp struct is identical to the utmpx struct so this only changes the external API entrypoints and NOT the underlying data source. This saves about 500b (~1300b from previously ~1950) while at it. Signed-off-by: Bernhard Reutner-Fischer --- libutil/logwtmp.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'libutil/logwtmp.c') diff --git a/libutil/logwtmp.c b/libutil/logwtmp.c index 6a53b5ff1..99b772fc4 100644 --- a/libutil/logwtmp.c +++ b/libutil/logwtmp.c @@ -9,13 +9,13 @@ #include #include #include -#include #include #include +#include "internal/utmp.h" void logwtmp(const char *line, const char *name, const char *host) { - struct utmp lutmp; + struct UT lutmp; memset(&lutmp, 0, sizeof(lutmp)); lutmp.ut_type = (name && *name) ? USER_PROCESS : DEAD_PROCESS; @@ -36,20 +36,3 @@ void logwtmp(const char *line, const char *name, const char *host) updwtmp(_PATH_WTMP, &lutmp); } - -#if 0 -/* This is enabled in uClibc/libc/misc/utmp/wtent.c */ -void updwtmp(const char *wtmp_file, const struct utmp *lutmp) -{ - int fd; - - fd = open(wtmp_file, O_APPEND | O_WRONLY); - if (fd >= 0) { - if (lockf(fd, F_LOCK, 0) == 0) { - write(fd, lutmp, sizeof(*lutmp)); - lockf(fd, F_ULOCK, 0); - close(fd); - } - } -} -#endif -- cgit v1.2.3