diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-02-18 10:21:22 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-02-18 10:21:22 -0300 |
commit | b064d501ae68a20f519064662205905dbe9f9b85 (patch) | |
tree | 20ba9b84f7a310ba19d27b6a37ccac198bc99b43 /linux | |
parent | ff78a1bfcea625aa19beea1747cd797efad90991 (diff) |
linux/Battery.c: make sure fd is always closed
Detected by Coverity:
https://scan8.coverity.com/reports.htm#v13252/p10402/fileInstanceId=22093957&defectInstanceId=7543348&mergedDefectId=174180
Diffstat (limited to 'linux')
-rw-r--r-- | linux/Battery.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/linux/Battery.c b/linux/Battery.c index 34a24011..aedacabc 100644 --- a/linux/Battery.c +++ b/linux/Battery.c @@ -110,16 +110,13 @@ static ACPresence procAcpiCheck() { char statePath[50]; xSnprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName); FILE* file = fopen(statePath, "r"); - if (!file) { isOn = AC_ERROR; continue; } - char* line = String_readLine(file); - if (!line) continue; - fclose(file); + if (!line) continue; const char *isOnline = String_getToken(line, 2); free(line); |