Skip to contentSkip to conversation

plausible: fix compilation on RHEL 5.x due to missing magic define

PATCH Applied Thomas De Schampheleire 2 participants 2 messages Oct 20, 2016 – Oct 25, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 plausible: fix compilation on RHEL 5.x due to missing magic define

From: Thomas De Schampheleire <[email protected]>

RHEL 5.x does have magic.h, but it does not define all expected symbols. In particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x is using 4.17.

Add substitute defines to allow continued usage of magic but without the requested exclude checks.

---
 lib/support/plausible.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Note: instead of filling in the actual (current) values for these defines, we could also have filled them with zero as libmagic will not recognize them anyway.

lib/support/plausible.c +11 -0
index 6f0c4bc..0636061 100644
@@ -43,6 +43,17 @@ static const char *(*dl_magic_file)(magic_t, const char *);
 static int (*dl_magic_load)(magic_t, const char *);
 static void (*dl_magic_close)(magic_t);
 
+/*
+ * NO_CHECK functionality was only added in file 4.20.
+ * Older systems like RHEL 5.x still have file 4.17
+ */
+#ifndef MAGIC_NO_CHECK_COMPRESS
+#define MAGIC_NO_CHECK_COMPRESS 0x0001000
+#endif
+#ifndef MAGIC_NO_CHECK_ELF
+#define MAGIC_NO_CHECK_ELF 0x0010000
+#endif
+
 #ifdef HAVE_DLOPEN
 #include <dlfcn.h>
 
Signature · 1 line
2.7.3
#1 lore raw
Quoted 10 lines · Thomas De Schampheleire

From: Thomas De Schampheleire <[email protected]>

RHEL 5.x does have magic.h, but it does not define all expected symbols. In particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x is using 4.17.

Add substitute defines to allow continued usage of magic but without the requested exclude checks.

Thanks, applied.

- Ted