1 Star 0 Fork 22

李宁杰/file

forked from src-openEuler/file 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-file-localmagic.patch 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
lihaoxiang 提交于 2023-02-09 02:21 . Upgrade to file-5.44
From bba354e18cfac11cc69a1032cbda23960b7c05d0 Mon Sep 17 00:00:00 2001
From: Jan Kaluza <hanzz.k@gmail.com>
Date: Thu, 15 Dec 2011 16:15:41 +0100
Subject: [PATCH] file-localmagic.patch
Upstream says it's up to distributions to add a way to support local-magic.
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
magic/magic.local | 3 +++
src/Makefile.am | 2 +-
src/apprentice.c | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
create mode 100644 magic/magic.local
diff --git a/magic/magic.local b/magic/magic.local
new file mode 100644
index 0000000..283a863
--- /dev/null
+++ b/magic/magic.local
@@ -0,0 +1,3 @@
+# Magic local data for file(1) command.
+# Insert here your local magic data. Format is described in magic(5).
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 96749b5..e3eaf36 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-MAGIC = $(pkgdatadir)/magic
+MAGIC = /etc/magic:$(pkgdatadir)/magic
lib_LTLIBRARIES = libmagic.la
nodist_include_HEADERS = magic.h
diff --git a/src/apprentice.c b/src/apprentice.c
index db21787..5134682 100644
--- a/src/apprentice.c
+++ b/src/apprentice.c
@@ -496,7 +496,7 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
#ifndef COMPILE_ONLY
map = apprentice_map(ms, fn);
if (map == NULL) {
- if (ms->flags & MAGIC_CHECK)
+ if (ms->flags & MAGIC_CHECK && strcmp("/etc/magic", fn) != 0)
file_magwarn(NULL, "using regular magic file `%s'", fn);
map = apprentice_load(ms, fn, action);
if (map == NULL)
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/li_ning_jie/file.git
git@gitee.com:li_ning_jie/file.git
li_ning_jie
file
file
master

搜索帮助