mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
More windows cleanup for slapi
Fix link dependencies. Fix file locking in printmsg.c.
This commit is contained in:
parent
3489931553
commit
a7bd0416c8
2 changed files with 26 additions and 6 deletions
|
|
@ -19,9 +19,6 @@ LIBRARY = libslapi.la
|
|||
#all-common: $(LIBRARY) $(PROGRAMS)
|
||||
# @touch plugin.c slapi_pblock.c slapi_utils.c slapi_ops.c slapi_ext.c
|
||||
|
||||
NT_SRCS = $(top_srcdir)/libraries/liblber/nt_err.c
|
||||
NT_OBJS = nt_err.lo
|
||||
|
||||
LIB_DEFS = -DSLAPI_LIBRARY
|
||||
|
||||
SRCS= plugin.c slapi_pblock.c slapi_utils.c printmsg.c slapi_ops.c slapi_dn.c slapi_ext.c slapi_overlay.c \
|
||||
|
|
@ -34,9 +31,12 @@ XSRCS= version.c
|
|||
LDAP_INCDIR= ../../../include -I.. -I.
|
||||
LDAP_LIBDIR= ../../../libraries
|
||||
|
||||
shared_LDAP_LIBS = $(LDAP_LIBLDAP_LA) $(LDAP_LIBLBER_LA)
|
||||
|
||||
XLIBS = $(LIBRARY)
|
||||
XXLIBS =
|
||||
NT_LINK_LIBS = $(AC_LIBS)
|
||||
MOD_LIBS = $(MODULES_LIBS)
|
||||
NT_LINK_LIBS = $(AC_LIBS) -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
|
||||
|
||||
XINCPATH = -I$(srcdir)/.. -I$(srcdir)
|
||||
XDEFS = $(MODULES_CPPFLAGS)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@
|
|||
#include <slap.h>
|
||||
#include <slapi.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include <ldap_pvt_thread.h>
|
||||
|
||||
/* Single threads access to routine */
|
||||
|
|
@ -60,18 +64,30 @@ slapi_int_log_error(
|
|||
|
||||
/* for now, we log all severities */
|
||||
if ( level <= slapi_log_level ) {
|
||||
#ifdef _WIN32
|
||||
intptr_t fhandle;
|
||||
#endif
|
||||
fp = fopen( slapi_log_file, "a" );
|
||||
if ( fp == NULL) {
|
||||
rc = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
fhandle = _get_osfhandle( fileno( fp ));
|
||||
#endif
|
||||
/*
|
||||
* FIXME: could block
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
while ( LockFile( fhandle, 0, 0, UINT_MAX, UINT_MAX ) == 0 ) {
|
||||
/* DO NOTHING */ ;
|
||||
}
|
||||
#else
|
||||
while ( lockf( fileno( fp ), F_LOCK, 0 ) != 0 ) {
|
||||
/* DO NOTHING */ ;
|
||||
}
|
||||
#endif
|
||||
|
||||
time( ¤tTime );
|
||||
ltm = localtime( ¤tTime );
|
||||
|
|
@ -85,7 +101,11 @@ slapi_int_log_error(
|
|||
}
|
||||
fflush( fp );
|
||||
|
||||
#ifdef _WIN32
|
||||
UnlockFile( fhandle, 0, 0, UINT_MAX, UINT_MAX );
|
||||
#else
|
||||
lockf( fileno( fp ), F_ULOCK, 0 );
|
||||
#endif
|
||||
|
||||
fclose( fp );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue