Skip to content
Snippets Groups Projects
Commit 3d491808 authored by Howard Chu's avatar Howard Chu
Browse files

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.
parent 54d93cc0
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,7 @@
#include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/signal.h>
......
......@@ -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);
......
......@@ -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;
......
......@@ -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).
......
......@@ -27,6 +27,7 @@
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/errno.h>
#include <ac/socket.h>
#include <ac/string.h>
......
......@@ -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 ) {
......
......@@ -23,6 +23,7 @@
#include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h>
#include "slurp.h"
#include "globals.h"
......
......@@ -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';
......
......@@ -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: "
......
......@@ -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';
}
......
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment