]> granicus.if.org Git - php/commitdiff
Return a success value from the startup function, so we can unload immediately
authorZeev Suraski <zeev@php.net>
Mon, 19 Apr 1999 21:39:18 +0000 (21:39 +0000)
committerZeev Suraski <zeev@php.net>
Mon, 19 Apr 1999 21:39:18 +0000 (21:39 +0000)
if it fails.

Zend/zend_extensions.c
Zend/zend_extensions.h

index ce49505f12b09898537a6f8731e4874ccbce2181..92eb410aa9177a0b40ea5add962397bd2ac0c9fa 100644 (file)
@@ -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;
index 502f807600c425d2e334eeb2fca6de47a446110c..cd1c3cb974fc76cb714acf1a23a93cf87000e03e 100644 (file)
@@ -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)();