]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: Fix unused variables in login.c if _HAVE_UT_TV isn't defined
authorWill Johansson <will.johansson@gmail.com>
Mon, 15 Dec 2014 11:51:29 +0000 (03:51 -0800)
committerKarel Zak <kzak@redhat.com>
Thu, 18 Dec 2014 10:02:08 +0000 (11:02 +0100)
Wrap around the variable declaration for `tv' with ifdef so the compilers
don't warn about unused variables if we're compiling without UT_TV. This
happens with the musl libc, since it doesn't define _HAVE_UT_TV, even
though it _does_ have the ut_tv field in the utmp struct.

Signed-off-by: Will Johansson <will.johansson@gmail.com>
login-utils/login.c

index 540554e77ab8f9886b6338b1dfaa57860f300204..f07358fae6eb3888549387a8cfed03c10ccc6674 100644 (file)
@@ -429,7 +429,9 @@ 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));