From 773502eb6c8dd6fc1611a2140786e281d2af404a Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 9 Feb 2017 23:17:13 +0100 Subject: ipcpd: Print size_t and uint64_t in portable way On 32-bit systems size_t is different than on 64 bit systems. The correct way to print a size_t is with %z. uint64_t is printed portably with the PRIu64 macro. --- src/ipcpd/normal/enroll.c | 8 ++++---- src/ipcpd/normal/main.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index fb4ff3c3..16bfc592 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -115,7 +115,7 @@ int enroll_handle(int fd) return -1; } - log_dbg("Packed %s (%lu bytes).", name, len); + log_dbg("Packed %s (%zu bytes).", name, len); free(name); @@ -186,7 +186,7 @@ int enroll_boot(char * dst_name) return -1; } - log_dbg("Packed information received (%lu bytes).", len); + log_dbg("Packed information received (%zu bytes).", len); if (rib_unpack(data, len, UNPACK_CREATE)) { log_warn("Error unpacking RIB data."); @@ -214,7 +214,7 @@ int enroll_boot(char * dst_name) return -1; } - log_dbg("Packed information received (%lu bytes).", len); + log_dbg("Packed information received (%zu bytes).", len); if (rib_unpack(data, len, UNPACK_CREATE)) { log_warn("Error unpacking RIB data."); @@ -242,7 +242,7 @@ int enroll_boot(char * dst_name) return -1; } - log_dbg("Packed information received (%lu bytes).", len); + log_dbg("Packed information received (%zu bytes).", len); if (rib_unpack(data, len, UNPACK_CREATE)) { log_warn("Error unpacking RIB data."); diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index b69bfe28..69f24fce 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -47,6 +47,7 @@ #include #include #include +#include #define DLR "/" #define DIF_PATH DLR DIF_NAME @@ -146,7 +147,7 @@ static int boot_components(void) len = rib_read(DIF_PATH, &buf, 256); if (len < 0) { - log_err("Failed to read DIF name: %ld.", len); + log_err("Failed to read DIF name: %zd.", len); return -1; } @@ -182,7 +183,7 @@ static int boot_components(void) return -1; } - log_dbg("IPCP got address %lu.", ipcpi.address); + log_dbg("IPCP got address %" PRIu64 ".", ipcpi.address); log_dbg("Starting ribmgr."); -- cgit v1.2.3