projects
/
suckless
/
slstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
af3cdfb
)
wifi_perc: Fix file descriptor leak
author
Aaron Marcher
<me@drkhsh.at>
Wed, 2 May 2018 17:41:53 +0000
(19:41 +0200)
committer
Aaron Marcher
<me@drkhsh.at>
Wed, 2 May 2018 17:41:53 +0000
(19:41 +0200)
components/wifi.c
patch
|
blob
|
history
diff --git
a/components/wifi.c
b/components/wifi.c
index 13b630aa122c538b4667cb5f1bbb2720f419841a..7cd2702ca1e9fc27666688167df1321fa5aa3725 100644
(file)
--- a/
components/wifi.c
+++ b/
components/wifi.c
@@
-30,10
+30,11
@@
strerror(errno));
return NULL;
}
- if(!(p = fgets(status, 5, fp)) || strcmp(status, "up\n") != 0) {
+ p = fgets(status, 5, fp);
+ fclose(fp);
+ if(!p || strcmp(status, "up\n") != 0) {
return NULL;
}
- fclose(fp);
if (!(fp = fopen("/proc/net/wireless", "r"))) {
fprintf(stderr, "fopen '/proc/net/wireless': %s\n",