From 921d4467e4cc8453e5b2ec902918b225916855b6 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Jul 2024 19:25:24 +0200 Subject: [PATCH] tools/nut-scanner/nut-scanner.c: upscale sockaddr flags to uintmax_t for debug printouts to be predictable on different platforms [#2244] Signed-off-by: Jim Klimov --- tools/nut-scanner/nut-scanner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/nut-scanner/nut-scanner.c b/tools/nut-scanner/nut-scanner.c index 306786dcfa..828fa42d3e 100644 --- a/tools/nut-scanner/nut-scanner.c +++ b/tools/nut-scanner/nut-scanner.c @@ -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; @@ -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);