cvs: php4(PHP_4_3) /ext/mime_magic mime_magic.c

From: Date: Fri, 15 Nov 2002 16:36:23 +0000
Subject: cvs: php4(PHP_4_3) /ext/mime_magic mime_magic.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-16299@lists.php.net to get a copy of this message
moriyoshi Fri Nov 15 11:36:23 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/mime_magic mime_magic.c Log: MFH Index: php4/ext/mime_magic/mime_magic.c diff -u php4/ext/mime_magic/mime_magic.c:1.13.2.1 php4/ext/mime_magic/mime_magic.c:1.13.2.2 --- php4/ext/mime_magic/mime_magic.c:1.13.2.1 Fri Nov 15 02:23:26 2002 +++ php4/ext/mime_magic/mime_magic.c Fri Nov 15 11:36:23 2002 @@ -15,7 +15,7 @@ | Author: Hartmut Holzgraefe <hartmut@six.de> | +----------------------------------------------------------------------+ - $Id: mime_magic.c,v 1.13.2.1 2002/11/15 07:23:26 sniper Exp $ + $Id: mime_magic.c,v 1.13.2.2 2002/11/15 16:36:23 moriyoshi Exp $ This module contains a lot of stuff taken from Apache mod_mime_magic, so the license section is a little bit longer than usual: @@ -304,6 +304,11 @@ return; } + if ((int) conf->magic == -1) { + php_error(E_ERROR, MODNAME " could not be initialized, magic file %s is not avaliable", conf->magicfile); + RETURN_FALSE; + } + if(!conf->magic) { php_error(E_WARNING, MODNAME " not initialized"); RETURN_FALSE; @@ -343,10 +348,9 @@ magic_server_config_rec *conf = &mime_global; fname = conf->magicfile; /* todo cwd? */ - f = fopen(fname, "r"); + f = fopen(fname, "rb"); if (f == NULL) { - php_error(E_WARNING, - MODNAME ": can't read magic file %s", fname); + (int) conf->magic = -1; return -1; }

« previous php.cvs (#16299) next »