From: Adam Borowski Date: Sun, 15 Oct 2017 19:09:03 +0000 (+0000) Subject: Fix a format string build failure on x32. X-Git-Tag: lxc-2.0.9~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27230248899c0f3a2649e7fa54dacff1845198c2;p=thirdparty%2Flxc.git Fix a format string build failure on x32. Both of struct timespec fields are 64-bit on any new architecture, even 32-bit ones. Signed-off-by: Adam Borowski --- diff --git a/src/lxc/log.c b/src/lxc/log.c index cdff17506..2668015e7 100644 --- a/src/lxc/log.c +++ b/src/lxc/log.c @@ -155,7 +155,7 @@ int lxc_unix_epoch_to_utc(char *buf, size_t bufsize, const struct timespec *time seconds = (time->tv_sec - d_in_s - h_in_s - (minutes * 60)); /* Make string from nanoseconds. */ - ret = snprintf(nanosec, LXC_NUMSTRLEN64, "%ld", time->tv_nsec); + ret = snprintf(nanosec, LXC_NUMSTRLEN64, "%"PRId64, (int64_t)time->tv_nsec); if (ret < 0 || ret >= LXC_NUMSTRLEN64) return -1;