tDon't call fclose on NULL fp - spoon - dwm status utility (2f30 fork) | |
git clone git://src.adamsgaard.dk/spoon | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 8daa0a03a61de62d8c8d702763a415b1ab7228ea | |
parent 64c48779dc5f4379409c3b6334e8911986663f61 | |
Author: sin <[email protected]> | |
Date: Sat, 16 Sep 2017 19:24:59 +0100 | |
Don't call fclose on NULL fp | |
Diffstat: | |
M netspeed.c | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/netspeed.c b/netspeed.c | |
t@@ -98,7 +98,7 @@ netspeedread(void *arg, char *buf, size_t len) | |
(void)snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/rx_by… | |
if (!(fp = fopen(path, "r"))) { | |
warn("fopen %s", path); | |
- goto err; | |
+ return -1; | |
} | |
if (fscanf(fp, "%llu", &rxbytes) != 1) { | |
warn("fscanf %s", path); | |
t@@ -108,7 +108,7 @@ netspeedread(void *arg, char *buf, size_t len) | |
(void)snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/tx_by… | |
if (!(fp = fopen(path, "r"))) { | |
warn("fopen %s", path); | |
- goto err; | |
+ return -1; | |
} | |
if (fscanf(fp, "%llu", &txbytes) != 1) { | |
warn("fscanf %s", path); |