aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-03-07 17:37:27 +0100
committerDuncaen <mail@duncano.de>2017-03-07 17:37:27 +0100
commit8ed1fc52aa5d0d346ca43e032b305a2c8bc7c0d2 (patch)
tree360535d3bba9437bffb792255087658c0b9eb97f
parent57df3f61a64a29ae8bbbaa3323e391b34c62f2c4 (diff)
downloadlobase-8ed1fc52aa5d0d346ca43e032b305a2c8bc7c0d2.tar.gz
lib/libutil: use ut_tv.tv_sec instead of ut_time in logwtmp on linux
-rw-r--r--lib/libutil/logwtmp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libutil/logwtmp.c b/lib/libutil/logwtmp.c
index 0f968c7..0919000 100644
--- a/lib/libutil/logwtmp.c
+++ b/lib/libutil/logwtmp.c
@@ -52,7 +52,11 @@ logwtmp(const char *line, const char *name, const char *host)
(void) strncpy(ut.ut_line, line, sizeof(ut.ut_line));
(void) strncpy(ut.ut_name, name, sizeof(ut.ut_name));
(void) strncpy(ut.ut_host, host, sizeof(ut.ut_host));
+#ifdef __linux
+ (void) time((time_t *)&ut.ut_tv.tv_sec);
+#else
(void) time(&ut.ut_time);
+#endif
if (write(fd, &ut, sizeof(struct utmp)) !=
sizeof(struct utmp))
(void) ftruncate(fd, buf.st_size);