On 7/23/2020 5:16 PM, Bruno Haible wrote:
Ken Brown wrote:
diff --git a/lib/fchmodat.c b/lib/fchmodat.c
index 895016860..eee0a1c56 100644
--- a/lib/fchmodat.c
+++ b/lib/fchmodat.c
@@ -98,7 +98,7 @@ fchmodat (int dir, char const *file, mode_t mode, int flags)
            return -1;
          }
-# if defined __linux__ || defined __ANDROID__
+#   if defined __linux__ || defined __ANDROID__ || defined __CYGWIN__
        static char const fmt[] = "/proc/self/fd/%d";
        char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
        sprintf (buf, fmt, fd);


So, chmod ("/proc/self/fd/n") works on Cygwin like on Linux. Then, we can make
the same change also in lchmod.c.


2020-07-23  Bruno Haible  <[email protected]>

        lchmod: Use /proc on Cygwin.
        * lib/lchmod.c (lchmod): Use /proc on Cygwin.

diff --git a/lib/lchmod.c b/lib/lchmod.c
index e113211..77a0060 100644
--- a/lib/lchmod.c
+++ b/lib/lchmod.c
@@ -76,7 +76,7 @@ lchmod (char const *file, mode_t mode)
        return -1;
      }
-# if defined __linux__ || defined __ANDROID__
+# if defined __linux__ || defined __ANDROID__ || defined __CYGWIN__
    static char const fmt[] = "/proc/self/fd/%d";
    char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
    sprintf (buf, fmt, fd);

Yes, that should work. Can you tell me how to test it? I've never had occasion to use Gnulib except indirectly, when building a project like Emacs that uses it. But the Cygwin build of Emacs doesn't seem to use lchmod.

Thanks.

Reply via email to