Subject: Re: 26.2.90; O_PATH problem on some versions of Cygwin

From: Paul Eggert <[email-masked]>
Date: Thu, 27 Jun 2019 13:47:27 -0700

Thanks, but that patch intrudes on the mainline code a bit. It's simpler 
to just disable O_PATH on Cygwin until the old Cygwin versions die out. 
Also, there's a similar issue in fileio.c. I installed the attached, 
which should work around the problem in both source files.
>From e7200b3cf9b4a6470197915a31c45739f078683b Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Thu, 27 Jun 2019 13:05:05 -0700
Subject: [PATCH] Work around Cygwin bug with O_PATH

Problem reported by Ken Brown (Bug#36405).
* src/dired.c, src/fileio.c (O_PATH) [__CYGWIN__]: Undef.
---
 src/dired.c  | 4 ++++
 src/fileio.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/dired.c b/src/dired.c
index 493758292b..b8197d36a0 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -41,6 +41,10 @@
 #include "buffer.h"
 #include "coding.h"
 
+#ifdef __CYGWIN__
+# undef O_PATH /* Buggy in Cygwin 3.0.0 through 3.0.7.  */
+#endif
+
 #ifdef MSDOS
 #include "msdos.h"	/* for fstatat */
 #endif
diff --git a/src/fileio.c b/src/fileio.c
index ed1d2aedf3..e36118652c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -61,6 +61,10 @@ Copyright (C) 1985-1988, 1993-2019 Free Software Foundation, Inc.
 # include <linux/fs.h>
 #endif
 
+#ifdef __CYGWIN__
+# undef O_PATH /* Buggy in Cygwin 3.0.0 through 3.0.7.  */
+#endif
+
 #ifdef WINDOWSNT
 #define NOMINMAX 1
 #include <windows.h>
-- 
2.21.0