From c340980b80b9ef0c957fe832e93e5ef430b216ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 4 Jun 2020 11:08:44 +0200 Subject: [PATCH] is_kernfs: Check only defined magic numbers Avoid undeclared identifiers when compiling with older kernel headers. --- src/dir_scan.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/dir_scan.c b/src/dir_scan.c index e145ac2..03a582b 100644 --- a/src/dir_scan.c +++ b/src/dir_scan.c @@ -63,18 +63,45 @@ static struct dir_ext buf_ext[1]; int exclude_kernfs; /* Exclude Linux pseudo filesystems */ static int is_kernfs(unsigned long type) { - if(type == BINFMTFS_MAGIC || + if( +#ifdef BINFMTFS_MAGIC + type == BINFMTFS_MAGIC || +#endif +#ifdef BPF_FS_MAGIC type == BPF_FS_MAGIC || +#endif +#ifdef CGROUP_SUPER_MAGIC type == CGROUP_SUPER_MAGIC || +#endif +#ifdef CGROUP2_SUPER_MAGIC type == CGROUP2_SUPER_MAGIC|| +#endif +#ifdef DEBUGFS_MAGIC type == DEBUGFS_MAGIC || +#endif +#ifdef DEVPTS_SUPER_MAGIC type == DEVPTS_SUPER_MAGIC || +#endif +#ifdef PROC_SUPER_MAGIC type == PROC_SUPER_MAGIC || +#endif +#ifdef PSTOREFS_MAGIC type == PSTOREFS_MAGIC || +#endif +#ifdef SECURITYFS_MAGIC type == SECURITYFS_MAGIC || +#endif +#ifdef SELINUX_MAGIC type == SELINUX_MAGIC || +#endif +#ifdef SYSFS_MAGIC type == SYSFS_MAGIC || - type == TRACEFS_MAGIC) +#endif +#ifdef TRACEFS_MAGIC + type == TRACEFS_MAGIC || +#endif + 0 + ) return 1; return 0;