]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10515 slapo-auditlog: Add Windows non-blocking support master
authorHoward Chu <hyc@openldap.org>
Fri, 5 Jun 2026 14:56:27 +0000 (15:56 +0100)
committerHoward Chu <hyc@openldap.org>
Fri, 5 Jun 2026 14:58:11 +0000 (15:58 +0100)
It doesn't work the same way as on Linux, so don't enable
the test script.

servers/slapd/overlays/auditlog.c

index d4b6e0949410d2fdad2ad5035aca86942cf80dfa..282c6a2f59e28f2e529286f27dd4ee7cdf629f48 100644 (file)
@@ -134,7 +134,7 @@ static int auditlog_response(Operation *op, SlapReply *rs) {
 
        /* Open file with optional non-blocking mode */
        flags = O_WRONLY | O_CREAT | O_APPEND;
-#ifdef O_NONBLOCK
+#ifndef _WIN32
        if ( ad->ad_nonblocking ) {
                flags |= O_NONBLOCK;
        }
@@ -149,6 +149,14 @@ static int auditlog_response(Operation *op, SlapReply *rs) {
                goto done;
        }
 
+#ifdef _WIN32
+       if ( ad->ad_nonblocking ) {
+               intptr_t fh = _get_osfhandle( fd );
+               DWORD mode = PIPE_NOWAIT;
+               SetNamedPipeHandleState( (HANDLE)fh, &mode, NULL, NULL );
+       }
+#endif
+
        stamp = slap_get_time();
        fprintf(f, "# %s %ld %s%s%s %s conn=%ld\n",
                what, (long)stamp, suffix, who ? " " : "", who ? who->bv_val : "",