Skip to content

Commit 5194025

Browse files
authored
filemap: define PROC_SUPER_MAGIC, avoid linux/magic.h (#2103)
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.
1 parent 79954d3 commit 5194025

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libyara/filemap.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@ YR_API int yr_filemap_map_fd(
159159

160160
#ifdef __linux__
161161
#include <sys/vfs.h>
162-
#include <linux/magic.h>
162+
// This constant can be found in linux/magic.h and the statfs(2) manpage.
163+
//
164+
// We don't want to include linux/magic.h here because it may not be
165+
// available in cross-build environments, see
166+
// https://github.com/Hugal31/yara-rust/issues/115
167+
#define PROC_SUPER_MAGIC 0x9fa0
163168
#endif
164169

165170
#define MAP_EXTRA_FLAGS 0

0 commit comments

Comments
 (0)