commit 8daa0a03a61de62d8c8d702763a415b1ab7228ea
parent 64c48779dc5f4379409c3b6334e8911986663f61
Author: sin <sin@2f30.org>
Date: Sat, 16 Sep 2017 19:24:59 +0100
Don't call fclose on NULL fp
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/netspeed.c b/netspeed.c
@@ -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);
@@ -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);