From: Scott MacVicar Date: Wed, 22 Oct 2008 16:34:17 +0000 (+0000) Subject: Fix a stat on a null when the internal database is used. X-Git-Tag: BEFORE_HEAD_NS_CHANGE~178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6978fff657caaedc02dc045246d76b3895a78097;p=php Fix a stat on a null when the internal database is used. --- diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index abef051f4b..12020e6ecb 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -251,9 +251,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; }