From 4d773f16e7e91f27669b4093ba2d6b8c9d3ee663 Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Wed, 21 Oct 2015 00:46:01 +0100
Subject: [PATCH] ITS#8280 Fix Windows EOL in test output

---
 tests/progs/ldif-filter.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/progs/ldif-filter.c b/tests/progs/ldif-filter.c
index 1bdb37cac9..cf9d257394 100644
--- a/tests/progs/ldif-filter.c
+++ b/tests/progs/ldif-filter.c
@@ -21,6 +21,9 @@
 #include <ac/stdlib.h>
 #include <ac/string.h>
 #include <ac/unistd.h>
+#ifdef _WIN32
+#include <fcntl.h>
+#endif
 
 #define DEFAULT_SPECS "ndb=a,null=n"
 
@@ -233,6 +236,9 @@ main( int argc, char **argv )
 		backend = "";
 	}
 
+#ifdef _WIN32
+	_setmode(1, _O_BINARY);	/* don't convert \n to \r\n on stdout */
+#endif
 	flags = get_flags( backend, specs );
 	filter_stdin( flags ? flags : get_flags( backend, DEFAULT_SPECS ));
 	if ( fclose( stdout ) == EOF ) {
-- 
GitLab