From 3d491808a8d12428eae124e73c49876befef3286 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 16 May 2002 10:51:45 +0000 Subject: [PATCH] Fixes for MingW: (passes test007, with LDAP_DIRSEP tweaks in slapd.conf) must include to get MAX_PATH defined. use LDAP_DIRSEP instead of '/' in paths define truncate/ftruncate macros, etc. --- servers/slurpd/admin.c | 1 + servers/slurpd/args.c | 8 ++++---- servers/slurpd/globals.c | 4 ++++ servers/slurpd/main.c | 2 ++ servers/slurpd/re.c | 1 + servers/slurpd/reject.c | 3 ++- servers/slurpd/replica.c | 1 + servers/slurpd/replog.c | 5 +++-- servers/slurpd/ri.c | 2 ++ servers/slurpd/sanity.c | 3 ++- servers/slurpd/slurp.h | 8 +++++++- 11 files changed, 29 insertions(+), 9 deletions(-) diff --git a/servers/slurpd/admin.c b/servers/slurpd/admin.c index 6e234408e0..758c06abf5 100644 --- a/servers/slurpd/admin.c +++ b/servers/slurpd/admin.c @@ -23,6 +23,7 @@ #include "portable.h" #include +#include #include diff --git a/servers/slurpd/args.c b/servers/slurpd/args.c index af03b10654..4262952524 100644 --- a/servers/slurpd/args.c +++ b/servers/slurpd/args.c @@ -61,7 +61,7 @@ doargs( 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 ); @@ -120,7 +120,7 @@ doargs( 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 ); @@ -135,11 +135,11 @@ doargs( } /* 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); diff --git a/servers/slurpd/globals.c b/servers/slurpd/globals.c index 3bafef5156..0bd0329ba0 100644 --- a/servers/slurpd/globals.c +++ b/servers/slurpd/globals.c @@ -32,7 +32,11 @@ 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; diff --git a/servers/slurpd/main.c b/servers/slurpd/main.c index 7a391221b5..8965ff0f79 100644 --- a/servers/slurpd/main.c +++ b/servers/slurpd/main.c @@ -111,8 +111,10 @@ main( * 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). diff --git a/servers/slurpd/re.c b/servers/slurpd/re.c index 7fd254893c..b921728ef0 100644 --- a/servers/slurpd/re.c +++ b/servers/slurpd/re.c @@ -27,6 +27,7 @@ #include +#include #include #include #include diff --git a/servers/slurpd/reject.c b/servers/slurpd/reject.c index d3346cf509..a8f2f657b7 100644 --- a/servers/slurpd/reject.c +++ b/servers/slurpd/reject.c @@ -26,6 +26,7 @@ #include +#include #include #include @@ -56,7 +57,7 @@ write_reject( 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 ) { diff --git a/servers/slurpd/replica.c b/servers/slurpd/replica.c index 9bb77ca8ef..f5bf393cb1 100644 --- a/servers/slurpd/replica.c +++ b/servers/slurpd/replica.c @@ -23,6 +23,7 @@ #include "portable.h" #include +#include #include "slurp.h" #include "globals.h" diff --git a/servers/slurpd/replog.c b/servers/slurpd/replog.c index a93f9040d5..f43965b8e7 100644 --- a/servers/slurpd/replog.c +++ b/servers/slurpd/replog.c @@ -24,6 +24,7 @@ #include +#include #include #include #include @@ -71,7 +72,7 @@ copy_replog( * 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'; @@ -89,7 +90,7 @@ copy_replog( return( -1 ); } strcpy( buf, dst ); - if (( p = strrchr( buf, '/' )) == NULL ) { + if (( p = strrchr( buf, LDAP_DIRSEP[0] )) == NULL ) { strcpy( buf, "." ); } else { *p = '\0'; diff --git a/servers/slurpd/ri.c b/servers/slurpd/ri.c index 5dbdaf855d..f7f2227875 100644 --- a/servers/slurpd/ri.c +++ b/servers/slurpd/ri.c @@ -53,7 +53,9 @@ Ri_process( 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: " diff --git a/servers/slurpd/sanity.c b/servers/slurpd/sanity.c index e6335b942b..271b1f1cb4 100644 --- a/servers/slurpd/sanity.c +++ b/servers/slurpd/sanity.c @@ -27,6 +27,7 @@ #include +#include #include #include @@ -185,7 +186,7 @@ filecheck( unsigned int ret = 0; strcpy( dir, f ); - p = strrchr( dir, '/' ); + p = strrchr( dir, LDAP_DIRSEP[0] ); if ( p != NULL ) { *p = '\0'; } diff --git a/servers/slurpd/slurp.h b/servers/slurpd/slurp.h index b8a84bcedc..0cb25e3736 100644 --- a/servers/slurpd/slurp.h +++ b/servers/slurpd/slurp.h @@ -20,7 +20,7 @@ #ifndef _SLURPD_H_ #define _SLURPD_H_ -#ifndef LDAP_SYSLOG +#if !defined(HAVE_WINSOCK) && !defined(LDAP_SYSLOG) #define LDAP_SYSLOG 1 #endif @@ -42,6 +42,12 @@ #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" -- 2.39.5