summaryrefslogtreecommitdiffstats
path: root/login-utils/login.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/login.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/login.c')
-rw-r--r--login-utils/login.c19
1 files changed, 0 insertions, 19 deletions
diff --git a/login-utils/login.c b/login-utils/login.c
index 2350fc3ec..043fce129 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -426,9 +426,7 @@ static void init_tty(struct login_context *cxt)
static void log_btmp(struct login_context *cxt)
{
struct utmp ut;
-#if defined(_HAVE_UT_TV) /* in <utmpbits.h> included by <utmp.h> */
struct timeval tv;
-#endif
memset(&ut, 0, sizeof(ut));
@@ -441,17 +439,9 @@ static void log_btmp(struct login_context *cxt)
if (cxt->tty_name)
xstrncpy(ut.ut_line, cxt->tty_name, sizeof(ut.ut_line));
-#if defined(_HAVE_UT_TV) /* in <utmpbits.h> included by <utmp.h> */
gettimeofday(&tv, NULL);
ut.ut_tv.tv_sec = tv.tv_sec;
ut.ut_tv.tv_usec = tv.tv_usec;
-#else
- {
- time_t t;
- time(&t);
- ut.ut_time = t; /* ut_time is not always a time_t */
- }
-#endif
ut.ut_type = LOGIN_PROCESS; /* XXX doesn't matter */
ut.ut_pid = cxt->pid;
@@ -614,18 +604,9 @@ static void log_utmp(struct login_context *cxt)
if (cxt->tty_name)
xstrncpy(ut.ut_line, cxt->tty_name, sizeof(ut.ut_line));
-#ifdef _HAVE_UT_TV /* in <utmpbits.h> included by <utmp.h> */
gettimeofday(&tv, NULL);
ut.ut_tv.tv_sec = tv.tv_sec;
ut.ut_tv.tv_usec = tv.tv_usec;
-#else
- {
- time_t t;
- time(&t);
- ut.ut_time = t; /* ut_time is not always a time_t */
- /* glibc2 #defines it as ut_tv.tv_sec */
- }
-#endif
ut.ut_type = USER_PROCESS;
ut.ut_pid = cxt->pid;
if (cxt->hostname) {