nfs-utils: fix -Wformat

This commit is contained in:
Đoàn Trần Công Danh 2021-02-22 07:45:47 +07:00
parent e8e63af32c
commit 180ad3d002

View file

@ -0,0 +1,44 @@
Index: utils/nfsdcltrack/nfsdcltrack.c
===================================================================
--- a/utils/nfsdcltrack/nfsdcltrack.c
+++ b/utils/nfsdcltrack/nfsdcltrack.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <getopt.h>
#include <string.h>
@@ -525,7 +526,7 @@ cltrack_gracedone(const char *timestr)
if (*tail)
return -EINVAL;
- xlog(D_GENERAL, "%s: grace done. gracetime=%ld", __func__, gracetime);
+ xlog(D_GENERAL, "%s: grace done. gracetime=%" PRId64, __func__, (int64_t)gracetime);
ret = sqlite_remove_unreclaimed(gracetime);
Index: utils/nfsdcltrack/sqlite.c
===================================================================
--- a/utils/nfsdcltrack/sqlite.c
+++ b/utils/nfsdcltrack/sqlite.c
@@ -40,6 +40,7 @@
#include <dirent.h>
#include <errno.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
@@ -544,8 +545,8 @@ sqlite_remove_unreclaimed(time_t grace_s
int ret;
char *err = NULL;
- ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld",
- grace_start);
+ ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %" PRId64,
+ (int64_t)grace_start);
if (ret < 0) {
return ret;
} else if ((size_t)ret >= sizeof(buf)) {