diff options
author | Bernd Schubert <bernd@bsbernd.com> | 2025-09-18 23:39:11 +0200 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-09-19 14:02:14 +0200 |
commit | 3e2cd9e46c87a57de374b82fd198328f7745e942 (patch) | |
tree | b9c810312020980871f28d2ff35d56243b693d74 /lib | |
parent | 52a633a5d4435f1965fc8d44cf9a705e6679f793 (diff) | |
download | libfuse-3e2cd9e46c87a57de374b82fd198328f7745e942.tar.gz |
fuse_log: Add __attribute__((format(printf, ) and fix warnings
fuse_log() did not have that attribute and so compilers
didn't give warnings for plain printf().
Add the attribute and fix related warnings.
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse.c | 8 | ||||
-rw-r--r-- | lib/fuse_lowlevel.c | 23 | ||||
-rw-r--r-- | lib/fuse_uring.c | 5 | ||||
-rw-r--r-- | lib/mount.c | 2 |
4 files changed, 23 insertions, 15 deletions
@@ -2122,10 +2122,10 @@ int fuse_fs_utimens(struct fuse_fs *fs, const char *path, if (fs->debug) { char buf[10]; - fuse_log(FUSE_LOG_DEBUG, "utimens[%s] %s %li.%09lu %li.%09lu\n", - file_info_string(fi, buf, sizeof(buf)), - path, tv[0].tv_sec, tv[0].tv_nsec, - tv[1].tv_sec, tv[1].tv_nsec); + fuse_log(FUSE_LOG_DEBUG, "utimens[%s] %s %jd.%09ld %jd.%09ld\n", + file_info_string(fi, buf, sizeof(buf)), + path, (intmax_t)tv[0].tv_sec, tv[0].tv_nsec, + (intmax_t)tv[1].tv_sec, tv[1].tv_nsec); } return fs->op.utimens(path, tv, fi); } diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index cb757cd..273d4dc 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -23,6 +23,7 @@ #include <pthread.h> #include <stdatomic.h> #include <stdint.h> +#include <inttypes.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -753,11 +754,15 @@ static int read_back(int fd, char *buf, size_t len) res = read(fd, buf, len); if (res == -1) { - fuse_log(FUSE_LOG_ERR, "fuse: internal error: failed to read back from pipe: %s\n", strerror(errno)); + fuse_log(FUSE_LOG_ERR, + "fuse: internal error: failed to read back from pipe: %s\n", + strerror(errno)); return -EIO; } if (res != len) { - fuse_log(FUSE_LOG_ERR, "fuse: internal error: short read back from pipe: %i from %zi\n", res, len); + fuse_log(FUSE_LOG_ERR, + "fuse: internal error: short read back from pipe: %i from %zd\n", + res, len); return -EIO; } return 0; @@ -2550,8 +2555,8 @@ static bool want_flags_valid(uint64_t capable, uint64_t want) uint64_t unknown_flags = want & (~capable); if (unknown_flags != 0) { fuse_log(FUSE_LOG_ERR, - "fuse: unknown connection 'want' flags: 0x%08lx\n", - unknown_flags); + "fuse: unknown connection 'want' flags: 0x%08llx\n", + (unsigned long long)unknown_flags); return false; } return true; @@ -2577,10 +2582,12 @@ int fuse_convert_to_conn_want_ext(struct fuse_conn_info *conn) fuse_lower_32_bits(conn->want_ext) != conn->want) { if (conn->want_ext != se->conn_want_ext) { fuse_log(FUSE_LOG_ERR, - "%s: Both conn->want_ext and conn->want are set.\n" - "want=%x, want_ext=%lx, se->want=%lx se->want_ext=%lx\n", - __func__, conn->want, conn->want_ext, - se->conn_want, se->conn_want_ext); + "%s: Both conn->want_ext and conn->want are set.\n" + "want=%x want_ext=%llx, se->want=%x se->want_ext=%llx\n", + __func__, conn->want, + (unsigned long long)conn->want_ext, + se->conn_want, + (unsigned long long)se->conn_want_ext); return -EINVAL; } diff --git a/lib/fuse_uring.c b/lib/fuse_uring.c index 4c6f0a4..85b5a7f 100644 --- a/lib/fuse_uring.c +++ b/lib/fuse_uring.c @@ -18,6 +18,7 @@ #include <liburing.h> #include <sys/sysinfo.h> #include <stdint.h> +#include <inttypes.h> #include <stdbool.h> #include <string.h> #include <unistd.h> @@ -180,7 +181,7 @@ static int fuse_uring_commit_sqe(struct fuse_ring_pool *ring_pool, ring_ent->req_commit_id); if (se->debug) { - fuse_log(FUSE_LOG_DEBUG, " unique: %llu, result=%d\n", + fuse_log(FUSE_LOG_DEBUG, " unique: %" PRIu64 ", result=%d\n", out->unique, ent_in_out->payload_sz); } @@ -453,7 +454,7 @@ static int fuse_uring_prepare_fetch_sqes(struct fuse_ring_queue *queue) sq_ready = io_uring_sq_ready(&queue->ring); if (sq_ready != ring_pool->queue_depth) { fuse_log(FUSE_LOG_ERR, - "SQE ready mismatch, expected %d got %d\n", + "SQE ready mismatch, expected %zu got %u\n", ring_pool->queue_depth, sq_ready); return -EINVAL; } diff --git a/lib/mount.c b/lib/mount.c index 2eb9673..5492680 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -361,7 +361,7 @@ static int setup_auto_unmount(const char *mountpoint, int quiet) res = socketpair(PF_UNIX, SOCK_STREAM, 0, fds); if(res == -1) { - fuse_log(FUSE_LOG_ERR, "Setting up auto-unmountsocketpair() failed", + fuse_log(FUSE_LOG_ERR, "Setting up auto-unmount socketpair() failed: %s\n", strerror(errno)); return -1; } |