diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2014-04-24 19:54:06 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-04-24 19:54:06 -0300 |
commit | 9eec37c432035b5a484731cbdaed0e95c7228939 (patch) | |
tree | 025c8ff2ae7e0c3d99739527612dd19f3ad0063a /BatteryMeter.c | |
parent | 27da00f339649078fd1c8f5f957095d47e47513b (diff) |
More sanity checks.
Diffstat (limited to 'BatteryMeter.c')
-rw-r--r-- | BatteryMeter.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/BatteryMeter.c b/BatteryMeter.c index fcdfb8ad..f2dfa6ab 100644 --- a/BatteryMeter.c +++ b/BatteryMeter.c @@ -85,9 +85,10 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short break; } - char line[50]; + char line[50] = ""; for (unsigned short int i = 0; i < lineNum; i++) { - fgets(line, sizeof line, file); + char* ok = fgets(line, sizeof line, file); + if (!ok) break; } fclose(file); |