From b547736c2cecf064169ae9f433d4a4b46fe4e576 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Wed, 5 Feb 2014 13:24:18 +0000 Subject: [PATCH] Avoid setting unused value and trick scan-build from clang into not warn about apparenly unused value. --- src/utmpdump.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utmpdump.c b/src/utmpdump.c index cef8cc3..91a3d3a 100644 --- a/src/utmpdump.c +++ b/src/utmpdump.c @@ -218,16 +218,16 @@ undump(FILE *fp, int forever, int oldfmt) { struct utmp ut; struct oldutmp uto; - char s_addr[16], s_time[29], *linestart, *line; + char s_addr[16], s_time[29], *linestart; int count = 0; - line = linestart = malloc(1024 * sizeof *linestart); + linestart = malloc(1024 * sizeof *linestart); s_addr[15] = 0; s_time[28] = 0; while(fgets(linestart, 1023, fp)) { - line = linestart; + char *line = linestart; memset(&ut, '\0', sizeof(ut)); sscanf(line, "[%hd] [%d] [%4c] ", &ut.ut_type, &ut.ut_pid, ut.ut_id); @@ -237,6 +237,7 @@ undump(FILE *fp, int forever, int oldfmt) line += gettok(line, ut.ut_host, sizeof(ut.ut_host), 1); line += gettok(line, s_addr, sizeof(s_addr)-1, 1); line += gettok(line, s_time, sizeof(s_time)-1, 0); + (void)line; /* Quiet down static source analyzers */ ut.ut_addr = inet_addr(s_addr); ut.ut_time = strtotime(s_time);