ee1fd2
From 95c993ff6bdfe92a7f519c4db60157a421e65b38 Mon Sep 17 00:00:00 2001
ee1fd2
From: Siteshwar Vashisht <svashisht@redhat.com>
ee1fd2
Date: Thu, 21 Feb 2019 15:26:38 +0100
ee1fd2
Subject: [PATCH] Upstream says it's up to distributions to add a way to
ee1fd2
 support local-magic.
ee1fd2
ee1fd2
---
ee1fd2
 magic/magic.local | 3 +++
ee1fd2
 src/Makefile.am   | 2 +-
ee1fd2
 src/Makefile.in   | 2 +-
ee1fd2
 src/apprentice.c  | 2 +-
ee1fd2
 4 files changed, 6 insertions(+), 3 deletions(-)
ee1fd2
 create mode 100644 magic/magic.local
ee1fd2
ee1fd2
diff --git a/magic/magic.local b/magic/magic.local
ee1fd2
new file mode 100644
ee1fd2
index 0000000..283a863
ee1fd2
--- /dev/null
ee1fd2
+++ b/magic/magic.local
ee1fd2
@@ -0,0 +1,3 @@
ee1fd2
+# Magic local data for file(1) command.
ee1fd2
+# Insert here your local magic data. Format is described in magic(5).
ee1fd2
+
ee1fd2
diff --git a/src/Makefile.am b/src/Makefile.am
ee1fd2
index 3f67f2c..b43cb8e 100644
ee1fd2
--- a/src/Makefile.am
ee1fd2
+++ b/src/Makefile.am
ee1fd2
@@ -1,4 +1,4 @@
ee1fd2
-MAGIC = $(pkgdatadir)/magic
ee1fd2
+MAGIC = /etc/magic:$(pkgdatadir)/magic
ee1fd2
 lib_LTLIBRARIES = libmagic.la
ee1fd2
 nodist_include_HEADERS = magic.h
ee1fd2
 
ee1fd2
diff --git a/src/Makefile.in b/src/Makefile.in
ee1fd2
index 59f3b5e..a8f56cf 100644
ee1fd2
--- a/src/Makefile.in
ee1fd2
+++ b/src/Makefile.in
ee1fd2
@@ -356,7 +356,7 @@ target_alias = @target_alias@
ee1fd2
 top_build_prefix = @top_build_prefix@
ee1fd2
 top_builddir = @top_builddir@
ee1fd2
 top_srcdir = @top_srcdir@
ee1fd2
-MAGIC = $(pkgdatadir)/magic
ee1fd2
+MAGIC = /etc/magic:$(pkgdatadir)/magic
ee1fd2
 lib_LTLIBRARIES = libmagic.la
ee1fd2
 nodist_include_HEADERS = magic.h
ee1fd2
 AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
ee1fd2
diff --git a/src/apprentice.c b/src/apprentice.c
ee1fd2
index 1437bcc..b609dd1 100644
ee1fd2
--- a/src/apprentice.c
ee1fd2
+++ b/src/apprentice.c
ee1fd2
@@ -460,7 +460,7 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
ee1fd2
 #ifndef COMPILE_ONLY
ee1fd2
 	map = apprentice_map(ms, fn);
ee1fd2
 	if (map == NULL) {
ee1fd2
-		if (ms->flags & MAGIC_CHECK)
ee1fd2
+		if (ms->flags & MAGIC_CHECK && strcmp("/etc/magic", fn) != 0)
ee1fd2
 			file_magwarn(ms, "using regular magic file `%s'", fn);
ee1fd2
 		map = apprentice_load(ms, fn, action);
ee1fd2
 		if (map == NULL)
ee1fd2
-- 
ee1fd2
2.25.4
ee1fd2