From de8c07c62ca7e28ad62efb63d9bd11b705fae423 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 7 Jan 1999 18:16:40 +0000 Subject: [PATCH] Updated SLAPD args/pid file codes to use DEFAULT_RUNDIR and DEFAULT_DIRSEP. Removed old defines. --- include/ldapconfig.h.edit | 10 ++++------ include/ldapconfig.h.nt | 12 +++++------- servers/slapd/daemon.c | 21 ++++++++++++--------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/include/ldapconfig.h.edit b/include/ldapconfig.h.edit index 2b7e09cde9..ff3233768a 100644 --- a/include/ldapconfig.h.edit +++ b/include/ldapconfig.h.edit @@ -31,11 +31,13 @@ /* * SHARED DEFINITIONS - things you should change */ +#define DEFAULT_DIRSEP "/" #define DEFAULT_BINDIR "%BINDIR%" #define DEFAULT_SBINDIR "%SBINDIR%" #define DEFAULT_DATADIR "%DATADIR%" #define DEFAULT_SYSCONFDIR "%SYSCONFDIR%" #define DEFAULT_LIBEXECDIR "%LIBEXECDIR%" +#define DEFAULT_RUNDIR "%RUNDIR%" #define DEFAULT_LDAP_CONF_FILE "%SYSCONFDIR%/ldap.conf" #define DEFAULT_LDAP_USERRC_FILE "ldaprc" @@ -213,13 +215,9 @@ Please try again later.\r\n" #define SLAPD_DEFAULT_SIZELIMIT 500 /* default timelimit to spend on a search */ #define SLAPD_DEFAULT_TIMELIMIT 3600 - /* location of the slapd pid file */ -#define SLAPD_PIDFILE "%RUNDIR%/slapd.pid" -#define SLAPD_PIDDIR "%RUNDIR%/" + /* extension of the slapd pid file */ #define SLAPD_PIDEXT ".pid" - /* location of the slapd args file */ -#define SLAPD_ARGSFILE "%RUNDIR%/slapd.args" -#define SLAPD_ARGSDIR "%RUNDIR%/" + /* extension of the slapd args file */ #define SLAPD_ARGSEXT ".args" /* dn of the special "monitor" entry */ #define SLAPD_MONITOR_DN "cn=monitor" diff --git a/include/ldapconfig.h.nt b/include/ldapconfig.h.nt index 94881f0082..4590031ed0 100644 --- a/include/ldapconfig.h.nt +++ b/include/ldapconfig.h.nt @@ -31,9 +31,7 @@ /* * SHARED DEFINITIONS - things you should change */ -/* - * SHARED DEFINITIONS - things you should change - */ +#define DEFAULT_DIRSEP "\\" #define DEFAULT_BINDIR "C:\\OpenLDAP\\bin" #define DEFAULT_SBINDIR "C:\\OpenLDAP\\sbin" #define DEFAULT_DATADIR "C:\\OpenLDAP\\share" @@ -217,10 +215,10 @@ Please try again later.\r\n" #define SLAPD_DEFAULT_SIZELIMIT 500 /* default timelimit to spend on a search */ #define SLAPD_DEFAULT_TIMELIMIT 3600 - /* location of the slapd pid file */ -#define SLAPD_PIDFILE "C:\\OpenLDAP\\run\\slapd.pid" - /* location of the slapd args file */ -#define SLAPD_ARGSFILE "C:\\OpenLDAP\\run\\slapd.args" + /* extension of the slapd pid file */ +#define SLAPD_PIDEXT ".pid" + /* extension of the slapd args file */ +#define SLAPD_ARGSEXT ".args" /* dn of the special "monitor" entry */ #define SLAPD_MONITOR_DN "cn=monitor" /* dn of the special "config" entry */ diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index a5531f2592..5a33a31e85 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -41,7 +41,7 @@ static void set_shutdown(int sig); static void do_nothing (int sig); /* we need the server's name for constructing the pid/args file names */ -#if defined( SLAPD_PIDFILE ) || defined( SLAPD_ARGSFILE ) +#if defined( SLAPD_PIDEXT ) || defined( SLAPD_ARGSEXT ) extern char *serverName; #define DEFAULT_SERVERNAME "slapd" #endif @@ -62,10 +62,10 @@ slapd_daemon( FILE *fp; int on = 1; -#ifdef SLAPD_PIDFILE +#ifdef SLAPD_PIDEXT char pidFile[BUFSIZ]; #endif -#ifdef SLAPD_ARGSFILE +#ifdef SLAPD_ARGSEXT char argsFile[BUFSIZ]; #endif @@ -149,19 +149,20 @@ slapd_daemon( Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 ); -#if defined( SLAPD_PIDFILE ) || defined( SLAPD_ARGSFILE ) +#if defined( SLAPD_PIDEXT ) || defined( SLAPD_ARGSEXT ) if ( !serverName ) serverName = DEFAULT_SERVERNAME; -#endif -#ifdef SLAPD_PIDFILE - sprintf( pidFile, "%s%s%s", SLAPD_PIDDIR, serverName, SLAPD_PIDEXT ); +#ifdef SLAPD_PIDEXT + sprintf( pidFile, "%s%s%s%s", DEFAULT_RUNDIR, DEFAULT_DIRSEP, + serverName, SLAPD_PIDEXT ); if ( (fp = fopen( pidFile, "w" )) != NULL ) { fprintf( fp, "%d\n", (int) getpid() ); fclose( fp ); } #endif -#ifdef SLAPD_ARGSFILE - sprintf( argsFile, "%s%s%s", SLAPD_ARGSDIR, serverName, SLAPD_ARGSEXT ); +#ifdef SLAPD_ARGSEXT + sprintf( argsFile, "%s%s%s%s", DEFAULT_RUNDIR, DEFAULT_DIRSEP, + serverName, SLAPD_ARGSEXT ); if ( (fp = fopen( argsFile, "w" )) != NULL ) { for ( i = 0; i < g_argc; i++ ) { fprintf( fp, "%s ", g_argv[i] ); @@ -170,6 +171,8 @@ slapd_daemon( fclose( fp ); } #endif +#endif + while ( !slapd_shutdown ) { struct sockaddr_in from; -- 2.39.5