must include <ac/stdlib.h> to get MAX_PATH defined.
use LDAP_DIRSEP instead of '/' in paths
define truncate/ftruncate macros, etc.
#include "portable.h"
#include <stdio.h>
+#include <ac/stdlib.h>
#include <ac/signal.h>
int i;
int rflag = 0;
- if ( (g->myname = strrchr( argv[0], '/' )) == NULL ) {
+ if ( (g->myname = strrchr( argv[0], LDAP_DIRSEP[0] )) == NULL ) {
g->myname = strdup( argv[0] );
} else {
g->myname = strdup( g->myname + 1 );
break;
case 't': /* dir to use for our copies of replogs */
g->slurpd_rdir = (char *)malloc (strlen(optarg) + sizeof("/replica"));
- sprintf(g->slurpd_rdir, "%s/replica", optarg);
+ sprintf(g->slurpd_rdir, "%s" LDAP_DIRSEP "replica", optarg);
break;
default:
usage( g->myname );
}
/* Set location/name of our private copy of the slapd replog file */
- sprintf( g->slurpd_replogfile, "%s/%s", g->slurpd_rdir,
+ sprintf( g->slurpd_replogfile, "%s" LDAP_DIRSEP "%s", g->slurpd_rdir,
DEFAULT_SLURPD_REPLOGFILE );
/* Set location/name of the slurpd status file */
- sprintf( g->slurpd_status_file, "%s/%s", g->slurpd_rdir,
+ sprintf( g->slurpd_status_file, "%s" LDAP_DIRSEP "%s", g->slurpd_rdir,
DEFAULT_SLURPD_STATUS_FILE );
ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldap_debug);
Globals *sglob;
int ldap_syslog = 0;
+#ifdef LOG_DEBUG
int ldap_syslog_level = LOG_DEBUG;
+#else
+int ldap_syslog_level = 0;
+#endif
int ldap_debug = 0;
* Detach from the controlling terminal
* unless the -d flag is given or in one-shot mode.
*/
+#ifndef HAVE_WINSOCK
if ( ! (sglob->no_detach || sglob->one_shot_mode) )
lutil_detach( 0, 0 );
+#endif
/*
* Start the main file manager thread (in fm.c).
#include <stdio.h>
+#include <ac/stdlib.h>
#include <ac/errno.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <stdio.h>
+#include <ac/stdlib.h>
#include <ac/errno.h>
#include <ac/unistd.h>
int rc;
ldap_pvt_thread_mutex_lock( &sglob->rej_mutex );
- sprintf( rejfile, "%s/%s:%d.rej", sglob->slurpd_rdir,
+ sprintf( rejfile, "%s" LDAP_DIRSEP "%s:%d.rej", sglob->slurpd_rdir,
ri->ri_hostname, ri->ri_port );
if ( access( rejfile, F_OK ) < 0 ) {
#include "portable.h"
#include <stdio.h>
+#include <ac/stdlib.h>
#include "slurp.h"
#include "globals.h"
#include <stdio.h>
+#include <ac/stdlib.h>
#include <ac/errno.h>
#include <ac/param.h>
#include <ac/string.h>
* with a fatal error.
*/
strcpy( buf, src );
- if (( p = strrchr( buf, '/' )) == NULL ) {
+ if (( p = strrchr( buf, LDAP_DIRSEP[0] )) == NULL ) {
strcpy( buf, "." );
} else {
*p = '\0';
return( -1 );
}
strcpy( buf, dst );
- if (( p = strrchr( buf, '/' )) == NULL ) {
+ if (( p = strrchr( buf, LDAP_DIRSEP[0] )) == NULL ) {
strcpy( buf, "." );
} else {
*p = '\0';
char *errmsg;
(void) SIGNAL( LDAP_SIGUSR1, do_nothing );
+#ifdef SIGPIPE
(void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
if ( ri == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG (( "ri", LDAP_LEVEL_ERR, "Ri_process: "
#include <stdio.h>
+#include <ac/stdlib.h>
#include <ac/unistd.h>
#include <ac/string.h>
unsigned int ret = 0;
strcpy( dir, f );
- p = strrchr( dir, '/' );
+ p = strrchr( dir, LDAP_DIRSEP[0] );
if ( p != NULL ) {
*p = '\0';
}
#ifndef _SLURPD_H_
#define _SLURPD_H_
-#ifndef LDAP_SYSLOG
+#if !defined(HAVE_WINSOCK) && !defined(LDAP_SYSLOG)
#define LDAP_SYSLOG 1
#endif
#include "ldap_defaults.h"
#include "ldif.h"
+#ifdef HAVE_WINSOCK
+#define ftruncate(a,b) _chsize(a,b)
+#define truncate(a,b) _lclose( _lcreat(a, 0))
+#define S_IRGRP 0
+#define S_IWGRP 0
+#endif
/* Default directory for slurpd's private copy of replication logs */
#define DEFAULT_SLURPD_REPLICA_DIR LDAP_RUNDIR LDAP_DIRSEP "openldap-slurp"