From 5bf36ce52452052b4d910c122af562c2236ce89d Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sat, 8 Jul 2023 16:35:00 +0100 Subject: [PATCH] Cast st_dev to dev_t when printing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit st_dev is not the same as dev_t, and on O32 architectures like mipsel it's an unsigned long, but dev_t is still unsigned long long, so they don't match and compilation fails: ../src/journal/cat.c: In function ‘run’: ../src/basic/format-util.h:46:19: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=] 46 | # define DEV_FMT "%" PRIu64 | ^~~ ../src/journal/cat.c:168:34: note: in expansion of macro ‘DEV_FMT’ 168 | if (asprintf(&s, DEV_FMT ":" INO_FMT, st.st_dev, st.st_ino) < 0) | ^~~~~~~ In file included from ../src/systemd/sd-journal.h:20, from ../src/journal/cat.c:11: /usr/include/inttypes.h:105:41: note: format string is defined here 105 | # define PRIu64 __PRI64_PREFIX "u" --- src/journal/cat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/journal/cat.c b/src/journal/cat.c index d3f7785ad3..609ddbaf6b 100644 --- a/src/journal/cat.c +++ b/src/journal/cat.c @@ -165,7 +165,7 @@ static int run(int argc, char *argv[]) { "Failed to fstat(%s): %m", FORMAT_PROC_FD_PATH(STDERR_FILENO)); - if (asprintf(&s, DEV_FMT ":" INO_FMT, st.st_dev, st.st_ino) < 0) + if (asprintf(&s, DEV_FMT ":" INO_FMT, (dev_t)st.st_dev, st.st_ino) < 0) return log_oom(); if (setenv("JOURNAL_STREAM", s, /* overwrite = */ true) < 0)