From dde6a84b93bf8ea23439568af32d75d71c64e013 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sun, 23 Nov 2014 23:06:22 -0600 Subject: [PATCH] wmacpi: Fix -Wunused-but-set-variable compiler warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In particular, libacpi.c: In function ‘procfs_get_battery_info’: libacpi.c:582:9: warning: variable ‘buflen’ set but not used [-Wunused-but-set-variable] int buflen; ^ --- wmacpi/libacpi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wmacpi/libacpi.c b/wmacpi/libacpi.c index fb77015..14d98d4 100644 --- a/wmacpi/libacpi.c +++ b/wmacpi/libacpi.c @@ -649,6 +649,10 @@ static int procfs_get_battery_info(global_t *globals, int batt_no) /* grab the file contents */ memset(buf, 0, sizeof(buf)); buflen = fread(buf, sizeof(buf), 1, file); + if (buflen != sizeof(buf) && ferror(file)) { + pfatal("Could not read file\n"); + return 1; + } fclose(file); /* check to see if there were any errors reported in the file */