Skip to contentSkip to conversation

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

PATCH Applied Will Johansson 2 participants 2 messages Dec 15, 2014 – Dec 18, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

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

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.

---
 login-utils/login.c | 2 ++
 1 file changed, 2 insertions(+)
login-utils/login.c +2 -0
index 540554e..f07358f 100644
@@ -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));
 
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Will Johansson
 login-utils/login.c | 2 ++
 1 file changed, 2 insertions(+)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com