From 782b7cefbf8923700d6cd2777e7ccbdeda7f6ce0 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Tue, 11 Jan 2022 12:18:35 -0500 Subject: fix scan-build/cppcheck warnings --- src/fcopy/main.c | 3 ++- src/fnettrace/hostnames | 2 +- src/fnettrace/main.c | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/fcopy/main.c b/src/fcopy/main.c index a9443a764..c64d20127 100644 --- a/src/fcopy/main.c +++ b/src/fcopy/main.c @@ -200,7 +200,8 @@ static char *proc_pid_to_self(const char *target) { // check where /proc/self points to static const char proc_self[] = "/proc/self"; - if (!(proc_pid = realpath(proc_self, NULL))) + proc_pid = realpath(proc_self, NULL); + if (proc_pid == NULL) goto done; // redirect /proc/PID/xxx -> /proc/self/XXX diff --git a/src/fnettrace/hostnames b/src/fnettrace/hostnames index 6b7a19689..a808a3b09 100644 --- a/src/fnettrace/hostnames +++ b/src/fnettrace/hostnames @@ -66,7 +66,7 @@ 9.9.9.0/24 Quad9 DNS 45.90.28.0/22 NextDNS 149.112.112.0/24 Quad9 DNS -149.112.120.0/21 CIRA DNS Csnada +149.112.120.0/21 CIRA DNS Canada 176.103.128.0/19 Adguard DNS 185.228.168.0/24 Cleanbrowsing DNS 193.0.0.0/21 whois.ripe.net Netherlands diff --git a/src/fnettrace/main.c b/src/fnettrace/main.c index 40025590e..ab65268fd 100644 --- a/src/fnettrace/main.c +++ b/src/fnettrace/main.c @@ -221,16 +221,15 @@ static void hnode_print(unsigned bw) { bw = adjust_bandwidth(bw); char stats[31]; if (bw > (1024 * 1024 * DISPLAY_INTERVAL)) - sprintf(stats, "%d MB/s ", bw / (1024 * 1024 * DISPLAY_INTERVAL)); + sprintf(stats, "%u MB/s ", bw / (1024 * 1024 * DISPLAY_INTERVAL)); else - sprintf(stats, "%d KB/s ", bw / (1024 * DISPLAY_INTERVAL)); + sprintf(stats, "%u KB/s ", bw / (1024 * DISPLAY_INTERVAL)); int len = snprintf(line, LINE_MAX, "%32s geoip %d, IP database %d\n", stats, geoip_calls, radix_nodes); adjust_line(line, len, cols); printf("%s", line); HNode *ptr = dlist; HNode *prev = NULL; - int row = 0; while (ptr) { HNode *next = ptr->dnext; if (--ptr->ttl > 0) { @@ -242,7 +241,7 @@ static void hnode_print(unsigned bw) { snprintf(bytes, 11, "%u KB/s", (unsigned) (ptr->bytes / (DISPLAY_INTERVAL * 1024))); else - snprintf(bytes, 11, "%u B/s", (unsigned) (ptr->bytes / DISPLAY_INTERVAL)); + snprintf(bytes, 11, "%u B/s ", (unsigned) (ptr->bytes / DISPLAY_INTERVAL)); char *hostname = ptr->hostname; if (!hostname) -- cgit v1.2.3-54-g00ecf