+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
/*
* Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
#include "portable.h"
#include <stdio.h>
-#include <stdlib.h> /* get free() */
+#include <ac/stdlib.h>
#include <ac/string.h>
#include <ac/signal.h>
/* Set up our signal handlers:
* SIG{TERM,INT,HUP} causes a shutdown
* LDAP_SIGUSR1 - does nothing, used to wake up sleeping threads.
- * LDAP_SIGUSR2 - causes slurpd to read its administrative interface file.
- * (not yet implemented).
+ * LDAP_SIGUSR2 - causes a shutdown
*/
(void) SIGNAL( LDAP_SIGUSR1, do_nothing );
- (void) SIGNAL( LDAP_SIGUSR2, do_admin );
+ (void) SIGNAL( LDAP_SIGUSR2, set_shutdown );
(void) SIGNAL( SIGTERM, set_shutdown );
(void) SIGNAL( SIGINT, set_shutdown );
+#ifdef SIGHUP
(void) SIGNAL( SIGHUP, set_shutdown );
+#endif
if ( sglob->one_shot_mode ) {
if ( file_nonempty( sglob->slapd_replogfile )) {
* Set a global flag which signals that we're shutting down.
*/
static RETSIGTYPE
-set_shutdown(int x)
+set_shutdown(int sig)
{
int i;
(sglob->replicas[ i ])->ri_wake( sglob->replicas[ i ]);
}
sglob->rq->rq_unlock( sglob->rq ); /* unlock queue */
- (void) SIGNAL( SIGTERM, set_shutdown ); /* reinstall handlers */
- (void) SIGNAL( SIGINT, set_shutdown );
- (void) SIGNAL( SIGHUP, set_shutdown );
+ (void) SIGNAL_REINSTALL( sig, set_shutdown ); /* reinstall handlers */
}
* A do-nothing signal handler.
*/
RETSIGTYPE
-do_nothing(int i)
+do_nothing(int sig)
{
- (void) SIGNAL( LDAP_SIGUSR1, do_nothing );
+ (void) SIGNAL_REINSTALL( sig, do_nothing );
}
)
{
FILE *fp, *lfp;
- Rq *rq = sglob->rq;
char *p;
if ( acquire_lock( f, &fp, &lfp ) < 0 ) {
while (( fgets( line, sizeof(line), fp ) != NULL ) &&
(( len = strlen( line )) > 1 )) {
- while ( lcur + len + 1 > lmax ) {
- lmax += BUFSIZ;
- buf = (char *) ch_realloc( buf, lmax );
- }
- strcpy( buf + lcur, line );
- lcur += len;
+
+ while ( lcur + len + 1 > lmax ) {
+ lmax += BUFSIZ;
+ buf = (char *) ch_realloc( buf, lmax );
+ }
+ strcpy( buf + lcur, line );
+ lcur += len;
}
return( buf );
}