nfsdcltrack/sqlite: Fix printf format
Subsystems (2)
PATCH 1/2 nfsdcltrack/sqlite: Fix printf format
sqlite.c: In function 'sqlite_remove_unreclaimed':
sqlite.c:547:71: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=]
547 | ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld",
| ~~^
| |
| long int
| %lld
548 | grace_start);
| ~~~~~~~~~~~
| |
| time_t {aka long long int}Found in Buildroot riscv32 build.
--- utils/nfsdcltrack/sqlite.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsdcltrack/sqlite.c +2 -1
@@ -46,6 +46,7 @@#include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> +#include <inttypes.h> #include <unistd.h> #include <sqlite3.h> #include <linux/limits.h>
@@ -544,7 +545,7 @@ sqlite_remove_unreclaimed(time_t grace_start)int ret;char *err =NULL ; - ret =snprintf (buf,sizeof (buf),"DELETE FROM clients WHERE time < %ld" , + ret =snprintf (buf,sizeof (buf),"DELETE FROM clients WHERE time < %" PRIu64, grace_start);if (ret <0 ) {return ret;
Signature · 1 line
2.32.0
PATCH 2/2 nfsdcltrack/nfsdcltrack.c: Fix printf format
nfsdcltrack.c: In function 'cltrack_gracedone':
nfsdcltrack.c:528:47: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=]
528 | xlog(D_GENERAL, "%s: grace done. gracetime=%ld", __func__, gracetime);
| ~~^ ~~~~~~~~~
| | |
| long int time_t {aka long long int}
| %lldFound in Buildroot riscv32 build.
--- utils/nfsdcltrack/nfsdcltrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsdcltrack/nfsdcltrack.c +2 -1
@@ -33,6 +33,7 @@#include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> +#include <inttypes.h> #include <unistd.h> #include <libgen.h> #include <sys/inotify.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=%" PRIu64, __func__, gracetime); ret =sqlite_remove_unreclaimed (gracetime);
Signature · 1 line
2.32.0
Quoted 12 lines · Petr Vorel
sqlite.c: In function 'sqlite_remove_unreclaimed':
sqlite.c:547:71: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=]547 | ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld", | ~~^ | | | long int | %lld 548 | grace_start); | ~~~~~~~~~~~ | | | time_t {aka long long int}
Quoted 5 lines
Found in Buildroot riscv32 build.
Signed-off-by Petr Vorel <[email protected]>
Both Committed... (tag: nfs-utils-2-5-5-rc1)
steved
Quoted 26 lines
--- utils/nfsdcltrack/sqlite.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)utils/nfsdcltrack/sqlite.c +2
-1@@ -46,6 +46,7 @@#include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> +#include <inttypes.h> #include <unistd.h> #include <sqlite3.h> #include <linux/limits.h> @@ -544,7 +545,7 @@ sqlite_remove_unreclaimed(time_t grace_start)int ret;char *err =NULL ; - ret =snprintf (buf,sizeof (buf),"DELETE FROM clients WHERE time < %ld" , + ret =snprintf (buf,sizeof (buf),"DELETE FROM clients WHERE time < %" PRIu64, grace_start);if (ret <0 ) {return ret;