From 32afae09800c36254c76373ab390068823c6cfd0 Mon Sep 17 00:00:00 2001 From: Hilko Bengen Date: Thu, 5 Sep 2024 15:11:08 +0000 Subject: [PATCH] filemap: define PROC_SUPER_MAGIC, avoid linux/magic.h (#2103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #1848 caused build issues with some "unusual" build configurations – apparently we can't rely on linux/magic.h being present when cross-building for musl libc. Defining PROC_SUPER_MAGIC should not cause a problems since it should be considered part of the Linux kernel/user API and it is unlikely to change. --- libyara/filemap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libyara/filemap.c b/libyara/filemap.c index f8d0672098..5327b154c0 100644 --- a/libyara/filemap.c +++ b/libyara/filemap.c @@ -159,7 +159,12 @@ YR_API int yr_filemap_map_fd( #ifdef __linux__ #include -#include +// This constant can be found in linux/magic.h and the statfs(2) manpage. +// +// We don't want to include linux/magic.h here because it may not be +// available in cross-build environments, see +// https://github.com/Hugal31/yara-rust/issues/115 +#define PROC_SUPER_MAGIC 0x9fa0 #endif #define MAP_EXTRA_FLAGS 0