Skip to content

Commit

Permalink
tools/nut-scanner/nut-scanner.c: upscale sockaddr flags to uintmax_t …
Browse files Browse the repository at this point in the history
…for debug printouts to be predictable on different platforms [networkupstools#2244]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jul 5, 2024
1 parent c267ed1 commit 921d446
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/nut-scanner/nut-scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ int main(int argc, char *argv[])

getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
getnameinfo(ifa->ifa_netmask, sizeof(struct sockaddr_in6), mask, sizeof(mask), NULL, 0, NI_NUMERICHOST);
printf("Interface: %s\tAddress: %s\tMask: %s (len: %i)\tFlags: %08x", ifa->ifa_name, addr, mask, masklen, ifa->ifa_flags);
printf("Interface: %s\tAddress: %s\tMask: %s (len: %i)\tFlags: %08" PRIxMAX, ifa->ifa_name, addr, mask, masklen, (uintmax_t)ifa->ifa_flags);
} else if (ifa->ifa_addr->sa_family == AF_INET) {
struct sockaddr_in *sa = (struct sockaddr_in *)ifa->ifa_addr;
struct sockaddr_in *sm = (struct sockaddr_in *)ifa->ifa_netmask;
Expand All @@ -777,7 +777,7 @@ int main(int argc, char *argv[])
masklen += i & 1;
i >>= 1;
}
printf("Interface: %s\tAddress: %s\tMask: %s (len: %i)\tFlags: %08x", ifa->ifa_name, addr, mask, masklen, ifa->ifa_flags);
printf("Interface: %s\tAddress: %s\tMask: %s (len: %i)\tFlags: %08" PRIxMAX, ifa->ifa_name, addr, mask, masklen, (uintmax_t)ifa->ifa_flags);
/*
} else {
printf("Addr family: %" PRIuMAX, (intmax_t)ifa->ifa_addr->sa_family);
Expand Down

0 comments on commit 921d446

Please sign in to comment.