summaryrefslogtreecommitdiffstats
path: root/contrib/file/src/magic.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/file/src/magic.c')
-rw-r--r--contrib/file/src/magic.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/contrib/file/src/magic.c b/contrib/file/src/magic.c
index bc8c344..87ac1cb 100644
--- a/contrib/file/src/magic.c
+++ b/contrib/file/src/magic.c
@@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.93 2015/04/15 23:47:58 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.95 2015/09/11 17:24:09 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -137,6 +137,14 @@ _w32_get_magic_relative_to(char **hmagicpath, HINSTANCE module)
PathRemoveFileSpecA(dllpath);
+ if (module) {
+ char exepath[MAX_PATH];
+ GetModuleFileNameA(NULL, exepath, MAX_PATH);
+ PathRemoveFileSpecA(exepath);
+ if (stricmp(exepath, dllpath) == 0)
+ goto out;
+ }
+
sp = strlen(dllpath);
if (sp > 3 && stricmp(&dllpath[sp - 3], "bin") == 0) {
_w32_append_path(hmagicpath,
@@ -595,6 +603,9 @@ magic_setparam(struct magic_set *ms, int param, const void *val)
case MAGIC_PARAM_ELF_NOTES_MAX:
ms->elf_notes_max = (uint16_t)*(const size_t *)val;
return 0;
+ case MAGIC_PARAM_REGEX_MAX:
+ ms->elf_notes_max = (uint16_t)*(const size_t *)val;
+ return 0;
default:
errno = EINVAL;
return -1;
@@ -620,6 +631,9 @@ magic_getparam(struct magic_set *ms, int param, void *val)
case MAGIC_PARAM_ELF_NOTES_MAX:
*(size_t *)val = ms->elf_notes_max;
return 0;
+ case MAGIC_PARAM_REGEX_MAX:
+ *(size_t *)val = ms->regex_max;
+ return 0;
default:
errno = EINVAL;
return -1;
OpenPOWER on IntegriCloud