diff options
author | Rosen Penev <rosenp@gmail.com> | 2020-04-13 14:14:45 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2020-04-13 14:47:24 -0400 |
commit | cb75ec49c0a92f55b2241eb1cd95a3fdf63f0dac (patch) | |
tree | 4544aca3773d7a6cbbefb9761d7f24d7e3b716a0 /utils | |
parent | f0d7bebaa75e132c4c984013eef474498ea7b665 (diff) | |
download | nfs-utils-cb75ec49c0a92f55b2241eb1cd95a3fdf63f0dac.tar.gz |
nfs-utils: print time in 64-bit
musl 1.2.0 defines time_t as 64-bit, even under 32-bit OSes.
Fixes -Wformat errors.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/idmapd/idmapd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c index c187e7d7..893159f1 100644 --- a/utils/idmapd/idmapd.c +++ b/utils/idmapd/idmapd.c @@ -54,6 +54,7 @@ #include <dirent.h> #include <unistd.h> #include <netdb.h> +#include <inttypes.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -172,7 +173,7 @@ flush_nfsd_cache(char *path, time_t now) int fd; char stime[32]; - sprintf(stime, "%ld\n", now); + sprintf(stime, "%" PRId64 "\n", (int64_t)now); fd = open(path, O_RDWR); if (fd == -1) return -1; @@ -625,8 +626,8 @@ nfsdcb(int UNUSED(fd), short which, void *data) /* Name */ addfield(&bp, &bsiz, im.im_name); /* expiry */ - snprintf(buf1, sizeof(buf1), "%lu", - time(NULL) + cache_entry_expiration); + snprintf(buf1, sizeof(buf1), "%" PRId64, + (int64_t)time(NULL) + cache_entry_expiration); addfield(&bp, &bsiz, buf1); /* Note that we don't want to write the id if the mapping * failed; instead, by leaving it off, we write a negative @@ -653,8 +654,8 @@ nfsdcb(int UNUSED(fd), short which, void *data) snprintf(buf1, sizeof(buf1), "%u", im.im_id); addfield(&bp, &bsiz, buf1); /* expiry */ - snprintf(buf1, sizeof(buf1), "%lu", - time(NULL) + cache_entry_expiration); + snprintf(buf1, sizeof(buf1), "%" PRId64, + (int64_t)time(NULL) + cache_entry_expiration); addfield(&bp, &bsiz, buf1); /* Note we're ignoring the status field in this case; we'll * just map to nobody instead. */ |