mirror of
https://github.com/php/php-src.git
synced 2026-03-27 17:52:16 +01:00
fix mime_magic problems with ZTS
This commit is contained in:
@@ -260,7 +260,9 @@ PHP_INI_END()
|
||||
*/
|
||||
static void php_mime_magic_init_globals(zend_mime_magic_globals *mime_magic_globals)
|
||||
{
|
||||
mime_global.magicfile = NULL;
|
||||
memset(mime_magic_globals, 0, sizeof(zend_mime_magic_globals));
|
||||
mime_global.magic = NULL;
|
||||
mime_global.last = NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -348,7 +350,7 @@ PHP_FUNCTION(mime_content_type)
|
||||
|
||||
if (conf->magic == (struct magic *)-1) {
|
||||
if(MIME_MAGIC_G(debug))
|
||||
php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_ERROR, "mime_magic could not be initialized, magic file %s is not available", conf->magicfile);
|
||||
php_error_docref("http://www.php.net/mime_magic" TSRMLS_CC, E_ERROR, "mime_magic could not be initialized, magic file %s is not available", MIME_MAGIC_G(magicfile));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -391,7 +393,11 @@ static int apprentice(void)
|
||||
magic_server_config_rec *conf = &mime_global;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
fname = conf->magicfile; /* todo cwd? */
|
||||
if (!MIME_MAGIC_G(magicfile)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fname = MIME_MAGIC_G(magicfile); /* todo cwd? */
|
||||
f = fopen(fname, "rb");
|
||||
if (f == NULL) {
|
||||
conf->magic = (struct magic *)-1;
|
||||
|
||||
@@ -343,7 +343,6 @@ typedef struct magic_rsl_s {
|
||||
|
||||
/* per-server info */
|
||||
typedef struct {
|
||||
char *magicfile; /* where magic be found */
|
||||
struct magic *magic; /* head of magic config list */
|
||||
struct magic *last;
|
||||
} magic_server_config_rec;
|
||||
|
||||
Reference in New Issue
Block a user