From adec6d75c14d10260f39de30914d20b48bc3e30a Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 5 Jun 2026 15:56:27 +0100 Subject: [PATCH] ITS#10515 slapo-auditlog: Add Windows non-blocking support It doesn't work the same way as on Linux, so don't enable the test script. --- servers/slapd/overlays/auditlog.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/servers/slapd/overlays/auditlog.c b/servers/slapd/overlays/auditlog.c index d4b6e09494..282c6a2f59 100644 --- a/servers/slapd/overlays/auditlog.c +++ b/servers/slapd/overlays/auditlog.c @@ -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 : "", -- 2.47.3