Skip to content

Commit

Permalink
fix scan-build/cppcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Jan 11, 2022
1 parent 965af14 commit 782b7ce
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/fcopy/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/fnettrace/hostnames
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/fnettrace/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit 782b7ce

Please sign in to comment.