From 1fa2f38f0f011010bf57522b42fcc168856a7003 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Tue, 20 Jan 2015 22:22:15 -0500 Subject: Assorted format fixes Types used for pids and uids in various interfaces are unpredictable. Too bad. --- src/shared/install-printf.c | 2 +- src/shared/log.c | 4 ++-- src/shared/sleep-config.c | 6 +++--- src/shared/util.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/shared') diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c index 1ee1243f4d..d853f17772 100644 --- a/src/shared/install-printf.c +++ b/src/shared/install-printf.c @@ -103,7 +103,7 @@ static int specifier_user_name(char specifier, void *data, void *userdata, char if (r < 0) return r; - if (asprintf(&printed, "%d", uid) < 0) + if (asprintf(&printed, UID_FMT, uid) < 0) return -ENOMEM; break; }} diff --git a/src/shared/log.c b/src/shared/log.c index f8c16de777..a870415a00 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -330,7 +330,7 @@ static int write_to_console( highlight = LOG_PRI(level) <= LOG_ERR && show_color; if (show_location) { - snprintf(location, sizeof(location), "(%s:%u) ", file, line); + snprintf(location, sizeof(location), "(%s:%i) ", file, line); char_array_0(location); IOVEC_SET_STRING(iovec[n++], location); } @@ -1050,7 +1050,7 @@ void log_received_signal(int level, const struct signalfd_siginfo *si) { get_process_comm(si->ssi_pid, &p); log_full(level, - "Received SIG%s from PID "PID_FMT" (%s).", + "Received SIG%s from PID %"PRIu32" (%s).", signal_to_string(si->ssi_signo), si->ssi_pid, strna(p)); } else diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index ae14c6bd4d..1064fd5cbd 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -167,7 +167,7 @@ int can_sleep_disk(char **types) { static int hibernation_partition_size(size_t *size, size_t *used) { _cleanup_fclose_ FILE *f; - int i; + unsigned i; assert(size); assert(used); @@ -190,8 +190,8 @@ static int hibernation_partition_size(size_t *size, size_t *used) { k = fscanf(f, "%ms " /* device/file */ "%ms " /* type of swap */ - "%zd " /* swap size */ - "%zd " /* used */ + "%zu " /* swap size */ + "%zu " /* used */ "%*i\n", /* priority */ &dev, &type, &size_field, &used_field); if (k != 4) { diff --git a/src/shared/util.h b/src/shared/util.h index 2d03ac8fd0..179c9615f9 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -69,7 +69,7 @@ #endif #if SIZEOF_TIME_T == 8 -# define PRI_TIME PRIu64 +# define PRI_TIME PRIi64 #elif SIZEOF_TIME_T == 4 # define PRI_TIME PRIu32 #else -- cgit v1.2.3-54-g00ecf