]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
More windows cleanup for slapi
authorhyc <hyc@symas.com>
Thu, 7 Sep 2023 20:04:18 +0000 (13:04 -0700)
committerHoward Chu <hyc@openldap.org>
Thu, 7 Sep 2023 20:13:35 +0000 (21:13 +0100)
Fix link dependencies.
Fix file locking in printmsg.c.

servers/slapd/slapi/Makefile.in
servers/slapd/slapi/printmsg.c

index da6fc046198e252b6a3b4944ac1bbf20a3b1c618..32ade0cc26f049a88275c6d04803d1edb80fb0d0 100644 (file)
@@ -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 \
@@ -31,12 +28,15 @@ OBJS=  plugin.lo slapi_pblock.lo slapi_utils.lo printmsg.lo slapi_ops.lo slapi_d
 
 XSRCS= version.c
 
-LDAP_INCDIR= ../../../include -I.. -I.       
-LDAP_LIBDIR= ../../../libraries       
+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)
index 15b60045ed8c4936cbdd853d5f4a3877ef0367ff..5251846f211d94fa4f83f1fcf3248133cdcce65f 100644 (file)
 #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( &currentTime );
                ltm = localtime( &currentTime );
@@ -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 );