From 3165691cbfea2450bc61eb769807c171c2a0ac0f Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 2 Dec 2005 11:47:10 +0000 Subject: [PATCH] ITS#4241 write pid / args file before starting backends --- servers/slapd/main.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) 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 ? -- 2.39.5