From b4b00742948eb2a1f94b6bf2f288df11bc0b6990 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Mon, 5 Nov 2018 21:19:39 +0100 Subject: [PATCH] libselinux: selinux_restorecon: fix printf format string specifier for uint64_t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fc_count is defined as uint64_t, which needs to be printed with PRIu64 (it is "llu" on x86 and "lu" on x86-64). Otherwise, building with 'CC="gcc -m32"' fails with: selinux_restorecon.c: In function ‘restorecon_sb’: selinux_restorecon.c:633:26: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=] fprintf(stdout, "\r%luk", fc_count / STAR_COUNT); ~~^ %llu Signed-off-by: Nicolas Iooss --- libselinux/src/selinux_restorecon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c index 41f22250..3df2d382 100644 --- a/libselinux/src/selinux_restorecon.c +++ b/libselinux/src/selinux_restorecon.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -630,7 +631,7 @@ static int restorecon_sb(const char *pathname, const struct stat *sb, fc_count / efile_count) : 100; fprintf(stdout, "\r%-.1f%%", (double)pc); } else { - fprintf(stdout, "\r%luk", fc_count / STAR_COUNT); + fprintf(stdout, "\r%" PRIu64 "k", fc_count / STAR_COUNT); } fflush(stdout); }