From: Luca Boccassi Date: Sat, 8 Jul 2023 15:35:00 +0000 (+0100) Subject: Cast st_dev to dev_t when printing X-Git-Tag: v254-rc2~52^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5bf36ce52452052b4d910c122af562c2236ce89d;p=thirdparty%2Fsystemd.git Cast st_dev to dev_t when printing 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" --- diff --git a/src/journal/cat.c b/src/journal/cat.c index d3f7785ad34..609ddbaf6b4 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)