[Pkg-wmaker-commits] [wmacpi] 36/105: wmacpi: Fix -Wunused-but-set-variable compiler warning.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Tue Aug 18 01:13:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmacpi.

commit ca591b4cf8804f011aac4080aeaa7da2fdbcfd85
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Sun Nov 23 23:06:22 2014 -0600

    wmacpi: Fix -Wunused-but-set-variable compiler warning.
    
    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;
             ^
---
 libacpi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libacpi.c b/libacpi.c
index fb77015..14d98d4 100644
--- a/libacpi.c
+++ b/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 */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmacpi.git



More information about the Pkg-wmaker-commits mailing list