From: Zeev Suraski Date: Mon, 19 Apr 1999 21:39:18 +0000 (+0000) Subject: Return a success value from the startup function, so we can unload immediately X-Git-Tag: BEFORE_PHP4_APACHE_MODULE_CHANGE~270 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7c30c1bdf209bc270755bcafac45908fc8daf2f;p=php Return a success value from the startup function, so we can unload immediately if it fails. --- diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index ce49505f12..92eb410aa9 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -63,6 +63,7 @@ int zend_load_extension(char *path) extension_version_info->required_zend_version, ZEND_VERSION, ZEND_EXTENSION_API_NO); + DL_UNLOAD(handle); return FAILURE; } else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) { /* we may be able to allow for downwards compatability in some harmless cases. */ @@ -73,17 +74,22 @@ int zend_load_extension(char *path) ZEND_EXTENSION_API_NO, new_extension->author, new_extension->URL); + DL_UNLOAD(handle); return FAILURE; } else if (ZTS_V!=extension_version_info->thread_safe) { zend_printf("Cannot load %s - it %s thread safe, whereas Zend %s\n", new_extension->name, (extension_version_info->thread_safe?"is":"isn't"), (ZTS_V?"is":"isn't")); + DL_UNLOAD(handle); return FAILURE; } if (new_extension->startup) { - new_extension->startup(new_extension); + if (new_extension->startup(new_extension)!=SUCCESS) { + DL_UNLOAD(handle); + return FAILURE; + } } extension = *new_extension; extension.handle = handle; diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 502f807600..cd1c3cb974 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -37,7 +37,7 @@ struct _zend_extension { char *URL; char *copyright; - void (*startup)(zend_extension *extension); + int (*startup)(zend_extension *extension); void (*shutdown)(zend_extension *extension); void (*activate)(); void (*deactivate)();