wifi_perc: Fix file descriptor leak
This commit is contained in:
parent
af3cdfbbc8
commit
699f6734d9
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue