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

index abef051f4b88c3ab035a67c2ab3ab57dbeb5de96..12020e6ecbdb5edfa050b2433420b6f27cbb6a7b 100644 (file)
@@ -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;
        }