Fixes for MingW: (passes test007, with LDAP_DIRSEP tweaks in slapd.conf)

must include <ac/stdlib.h> to get MAX_PATH defined.
  use LDAP_DIRSEP instead of '/' in paths
  define truncate/ftruncate macros, etc.
This commit is contained in:
Howard Chu 2002-05-16 10:51:45 +00:00
parent 54d93cc003
commit 3d491808a8
11 changed files with 29 additions and 9 deletions

View file

@ -23,6 +23,7 @@
#include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/signal.h>

View file

@ -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);

View file

@ -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;

View file

@ -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).

View file

@ -27,6 +27,7 @@
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/errno.h>
#include <ac/socket.h>
#include <ac/string.h>

View file

@ -26,6 +26,7 @@
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/errno.h>
#include <ac/unistd.h>
@ -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 ) {

View file

@ -23,6 +23,7 @@
#include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h>
#include "slurp.h"
#include "globals.h"

View file

@ -24,6 +24,7 @@
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/errno.h>
#include <ac/param.h>
#include <ac/string.h>
@ -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';

View file

@ -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: "

View file

@ -27,6 +27,7 @@
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/unistd.h>
#include <ac/string.h>
@ -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';
}

View file

@ -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"