]> git.sur5r.net Git - openldap/commitdiff
ITS#4241 write pid / args file before starting backends
authorHoward Chu <hyc@openldap.org>
Fri, 2 Dec 2005 11:47:10 +0000 (11:47 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 2 Dec 2005 11:47:10 +0000 (11:47 +0000)
servers/slapd/main.c

index 9b9f45f1f990ec9519c39f68b14918069c60dd91..ec4b40ab28138b39f1eafde90005631a202db67f 100644 (file)
@@ -729,20 +729,6 @@ unhandled_option:;
        mal_leaktrace(1);
 #endif
 
-       /*
-        * FIXME: moved here from slapd_daemon_task()
-        * because back-monitor db_open() needs it
-        */
-       time( &starttime );
-
-       if ( slap_startup( NULL ) != 0 ) {
-               rc = 1;
-               SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 21 );
-               goto shutdown;
-       }
-
-       Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
-
        if ( slapd_pid_file != NULL ) {
                FILE *fp = fopen( slapd_pid_file, "w" );
 
@@ -758,7 +744,7 @@ unhandled_option:;
                        slapd_pid_file = NULL;
 
                        rc = 1;
-                       goto shutdown;
+                       goto destroy;
                }
 
                fprintf( fp, "%d\n", (int) getpid() );
@@ -780,7 +766,7 @@ unhandled_option:;
                        slapd_args_file = NULL;
 
                        rc = 1;
-                       goto shutdown;
+                       goto destroy;
                }
 
                for ( i = 0; i < g_argc; i++ ) {
@@ -790,6 +776,20 @@ unhandled_option:;
                fclose( fp );
        }
 
+       /*
+        * FIXME: moved here from slapd_daemon_task()
+        * because back-monitor db_open() needs it
+        */
+       time( &starttime );
+
+       if ( slap_startup( NULL ) != 0 ) {
+               rc = 1;
+               SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 21 );
+               goto shutdown;
+       }
+
+       Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
+
 #ifdef HAVE_NT_EVENT_LOG
        if (is_NT_Service)
        lutil_LogStartedEvent( serverName, slap_debug, configfile ?