diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:29 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:29 +0200 |
commit | eaf11cc12a1aa4b050a8a1e7ea3770d3d9c81e95 (patch) | |
tree | 833f3fae6e3604a439f909c245a6e35f574997d7 /BatteryMeter.c | |
parent | 283707c5e5bc436b78ea23bf5500cb6b16a01148 (diff) | |
download | debian_htop-eaf11cc12a1aa4b050a8a1e7ea3770d3d9c81e95.tar.gz debian_htop-eaf11cc12a1aa4b050a8a1e7ea3770d3d9c81e95.tar.bz2 debian_htop-eaf11cc12a1aa4b050a8a1e7ea3770d3d9c81e95.zip |
Imported Upstream version 1.0upstream/1.0
Diffstat (limited to 'BatteryMeter.c')
-rw-r--r-- | BatteryMeter.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/BatteryMeter.c b/BatteryMeter.c index 36b90e7..f7323aa 100644 --- a/BatteryMeter.c +++ b/BatteryMeter.c @@ -1,6 +1,6 @@ /* htop - (C) 2004-2010 Hisham H. Muhammad + (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. @@ -45,7 +45,7 @@ static unsigned long int parseUevent(FILE * file, const char *key) { } static unsigned long int parseBatInfo(const char *fileName, const unsigned short int lineNum, const unsigned short int wordNum) { - const DIR *batteryDir; + DIR* batteryDir; const struct dirent *dirEntries; const char batteryPath[] = PROCDIR "/acpi/battery/"; @@ -89,6 +89,7 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short snprintf((char *) infoPath, sizeof infoPath, "%s%s/%s", batteryPath, newEntry->content, fileName); if ((file = fopen(infoPath, "r")) == NULL) { + closedir(batteryDir); return 0; } @@ -107,7 +108,7 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short free(myList); free(newEntry); - closedir((DIR *) batteryDir); + closedir(batteryDir); return total; } @@ -274,6 +275,7 @@ static double getSysBatData() { } else { //reset file pointer if (fseek(file, 0, SEEK_SET) < 0) { + closedir(power_supplyDir); fclose(file); return 0; } @@ -285,6 +287,7 @@ static double getSysBatData() { } else { //reset file pointer if (fseek(file, 0, SEEK_SET) < 0) { + closedir(power_supplyDir); fclose(file); return 0; } |