libselinux: selinux_restorecon: fix printf format string specifier for uint64_t

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 <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2018-11-05 21:19:39 +01:00
parent a3be73bea4
commit b4b0074294
No known key found for this signature in database
GPG Key ID: C191415F340DAAA0
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@
#include <errno.h>
#include <fcntl.h>
#include <fts.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <sys/types.h>
@ -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);
}