summaryrefslogtreecommitdiffstats
path: root/login-utils/utmpdump.c
diff options
context:
space:
mode:
authorRuediger Meier2016-12-01 09:52:05 +0100
committerKarel Zak2016-12-07 12:35:24 +0100
commit55771f54096eec064d8284a54a119f0b371cd7fb (patch)
treec2eab93c45484a6faf38426dee7bd98533a2649e /login-utils/utmpdump.c
parentlast: include libgen.h for basename(3p) (diff)
downloadkernel-qcow2-util-linux-55771f54096eec064d8284a54a119f0b371cd7fb.tar.gz
kernel-qcow2-util-linux-55771f54096eec064d8284a54a119f0b371cd7fb.tar.xz
kernel-qcow2-util-linux-55771f54096eec064d8284a54a119f0b371cd7fb.zip
login-utils: remove _HAVE_UT_TV fallback
_HAVE_UT_TV is glibc only. Moreover we want to move to utmpx where timeval is standard. Now utmp/subsecond (1173d0a6) should work on all supported systems. CC: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'login-utils/utmpdump.c')
-rw-r--r--login-utils/utmpdump.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/login-utils/utmpdump.c b/login-utils/utmpdump.c
index cf8a50d8f..8f438b001 100644
--- a/login-utils/utmpdump.c
+++ b/login-utils/utmpdump.c
@@ -71,7 +71,6 @@ static time_t strtotime(const char *s_time)
return timegm(&tm);
}
-#if defined(_HAVE_UT_TV)
static suseconds_t strtousec(const char *s_time)
{
const char *s = strchr(s_time, ',');
@@ -79,7 +78,6 @@ static suseconds_t strtousec(const char *s_time)
return (suseconds_t) atoi(s + 1);
return 0;
}
-#endif
#define cleanse(x) xcleanse(x, sizeof(x))
static void xcleanse(char *s, int len)
@@ -287,12 +285,10 @@ static void undump(FILE *in, FILE *out)
inet_pton(AF_INET, s_addr, &(ut.ut_addr_v6));
else
inet_pton(AF_INET6, s_addr, &(ut.ut_addr_v6));
-#if defined(_HAVE_UT_TV)
+
ut.ut_tv.tv_sec = strtotime(s_time);
ut.ut_tv.tv_usec = strtousec(s_time);
-#else
- ut.ut_time = strtotime(s_time);
-#endif
+
ignore_result( fwrite(&ut, sizeof(ut), 1, out) );
++count;