tDon't call fclose on NULL fp - spoon - dwm status utility (2f30 fork)
(HTM) git clone git://src.adamsgaard.dk/spoon
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 8daa0a03a61de62d8c8d702763a415b1ab7228ea
(DIR) parent 64c48779dc5f4379409c3b6334e8911986663f61
(HTM) Author: sin <sin@2f30.org>
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(-)
---
(DIR) 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_bytes", ifname);
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_bytes", ifname);
if (!(fp = fopen(path, "r"))) {
warn("fopen %s", path);
- goto err;
+ return -1;
}
if (fscanf(fp, "%llu", &txbytes) != 1) {
warn("fscanf %s", path);