From 2dcc87d4328079489fd96eb0fd29a52aefa33fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 11 Nov 2017 14:27:10 +0100 Subject: [PATCH] tools/sepdebugcrcfix: Conditionally use MAP_POPULATE with mmap() Not all architectures offer MAP_POPULATE. As MAP_POPULATE is only an optimization to improve performance, it is safe to drop it when it is unavailable. Original message from patch file: > Fix compilation on platforms without MAP_POPULATE Original patch URI: https://salsa.debian.org/pkg-rpm-team/rpm/raw/1af008f89ee30a604de1c617c8bb9dc4dcd8bf81/debian/patches/map-populate.patch --- tools/sepdebugcrcfix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c index b85434eb71..fba460014f 100644 --- a/tools/sepdebugcrcfix.c +++ b/tools/sepdebugcrcfix.c @@ -154,7 +154,11 @@ crc32 (const char *fname, const char *base_fname, uint32_t *crcp) void *map = NULL; if (buf == NULL) { - map = mmap (NULL, maplen, PROT_READ, MAP_PRIVATE | MAP_POPULATE, + map = mmap (NULL, maplen, PROT_READ, MAP_PRIVATE +#ifdef MAP_POPULATE + | MAP_POPULATE +#endif + , fd, offset); if (map == MAP_FAILED) {