From: Howard Chu Date: Fri, 5 Jun 2026 14:56:27 +0000 (+0100) Subject: ITS#10515 slapo-auditlog: Add Windows non-blocking support X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;ds=sidebyside;p=thirdparty%2Fopenldap.git 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. --- 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 : "",