util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Johansson <will.johansson@gmail.com>
To: util-linux@vger.kernel.org
Cc: Will Johansson <will.johansson@gmail.com>
Subject: [PATCH] login-utils: Fix unused variables in login.c if _HAVE_UT_TV isn't defined
Date: Mon, 15 Dec 2014 03:51:29 -0800	[thread overview]
Message-ID: <1418644289-46965-1-git-send-email-will.johansson@gmail.com> (raw)

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 | 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


             reply	other threads:[~2014-12-15 11:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15 11:51 Will Johansson [this message]
2014-12-18 10:02 ` [PATCH] login-utils: Fix unused variables in login.c if _HAVE_UT_TV isn't defined Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418644289-46965-1-git-send-email-will.johansson@gmail.com \
    --to=will.johansson@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).