]> granicus.if.org Git - php/commitdiff
MFH: Fix a stat on a null when the internal database is used.
authorScott MacVicar <scottmac@php.net>
Wed, 22 Oct 2008 16:34:40 +0000 (16:34 +0000)
committerScott MacVicar <scottmac@php.net>
Wed, 22 Oct 2008 16:34:40 +0000 (16:34 +0000)
ext/fileinfo/libmagic/apprentice.c

index 5e4b2bdad5985b067a4dcbcd7223a79a4e770a69..97e52c0610e432e2eceb7a84457d8546c3e8c915 100644 (file)
@@ -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;
        }