From: Howard Chu Date: Fri, 2 Dec 2005 11:47:10 +0000 (+0000) Subject: ITS#4241 write pid / args file before starting backends X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~648 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3165691cbfea2450bc61eb769807c171c2a0ac0f;p=openldap ITS#4241 write pid / args file before starting backends --- diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 9b9f45f1f9..ec4b40ab28 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -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 ?