X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/a37224bf7b7eed62ff7574cc667202e905fc0d43..d47d78255ef8ede773c69a97e2cb5de78cee7da9:/components/netspeeds.c diff --git a/components/netspeeds.c b/components/netspeeds.c index 5af5a94..b4e6972 100644 --- a/components/netspeeds.c +++ b/components/netspeeds.c @@ -61,13 +61,15 @@ uint64_t oldrxbytes; static uint64_t rxbytes = 0; extern const unsigned int interval; - char if_ok = 0; + int if_ok = 0; + + oldrxbytes = rxbytes; if (getifaddrs(&ifal) == -1) { warn("getifaddrs failed"); return NULL; } - oldrxbytes = rxbytes; + rxbytes = 0; for (ifa = ifal; ifa; ifa = ifa->ifa_next) { if (!strcmp(ifa->ifa_name, interface) && (ifd = (struct if_data *)ifa->ifa_data)) { @@ -92,13 +94,15 @@ uint64_t oldtxbytes; static uint64_t txbytes = 0; extern const unsigned int interval; - char if_ok = 0; + int if_ok = 0; + + oldtxbytes = txbytes; if (getifaddrs(&ifal) == -1) { warn("getifaddrs failed"); return NULL; } - oldtxbytes = txbytes; + txbytes = 0; for (ifa = ifal; ifa; ifa = ifa->ifa_next) { if (!strcmp(ifa->ifa_name, interface) && (ifd = (struct if_data *)ifa->ifa_data)) {