From d3aa098cf629bab2e1c044777dce041a3cbd1941 Mon Sep 17 00:00:00 2001 From: William Brown Date: May 22 2017 23:22:56 +0000 Subject: Ticket 49099 - resolve systemd startup interaction with ns Bug Description: In systemd, it expects our process to stay in the foreground. Due to a mistake, I put config parsing after systemd parsing, which meant that we over-wrote the setting Fix Description: Move systemd notify processing to after command line processing. https://pagure.io/389-ds-base/issue/49099 Author: wibrown Review by: vashirov, mreynolds (Thanks!) --- diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index 85e4c6f..bc65775 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -676,7 +676,18 @@ main( int argc, char **argv) } } + + /* used to set configfile to the default config file name here */ + if ( (myname = strrchr( argv[0], '/' )) == NULL ) { + myname = slapi_ch_strdup( argv[0] ); + } else { + myname = slapi_ch_strdup( myname + 1 ); + } + + process_command_line(argc,argv,&extraname); + #ifdef WITH_SYSTEMD + /* Note: Must come *after* processing CLI, to override the should_detach flag */ /* * HUGE WARNING: Systemd has some undocumented magic. with Type=notify, this * acts as type=simple, but waits for ns-slapd to tell systemd it's good to go. @@ -696,16 +707,6 @@ main( int argc, char **argv) } #endif - - /* used to set configfile to the default config file name here */ - if ( (myname = strrchr( argv[0], '/' )) == NULL ) { - myname = slapi_ch_strdup( argv[0] ); - } else { - myname = slapi_ch_strdup( myname + 1 ); - } - - process_command_line(argc,argv,&extraname); - if (NULL == slapdFrontendConfig->configdir) { usage( myname, extraname ); exit( 1 );