[PATCH] login-utils: Fix unused variables in login.c if _HAVE_UT_TV isn't defined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 login-utils/login.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/login-utils/login.c b/login-utils/login.c
index 540554e..f07358f 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -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));
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux