From a8c8963bc04053c63f1015360ddb690144684c63 Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Wed, 22 Oct 2008 16:34:40 +0000 Subject: [PATCH] MFH: Fix a stat on a null when the internal database is used. --- ext/fileinfo/libmagic/apprentice.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 5e4b2bdad5..97e52c0610 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -257,9 +257,12 @@ apprentice_1(struct magic_set *ms, const char *fn, int action, } if ((rv = apprentice_map(ms, &magic, &nmagic, fn)) == -1) { - if (ms->flags & MAGIC_CHECK) - file_magwarn(ms, "using regular magic file `%s'", fn); - rv = apprentice_load(ms, &magic, &nmagic, fn, action); + if (fn) { + if (ms->flags & MAGIC_CHECK) + file_magwarn(ms, "using regular magic file `%s'", fn); + rv = apprentice_load(ms, &magic, &nmagic, fn, action); + } + if (rv != 0) return -1; } -- 2.40.0