[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] fchmodat: Use /proc on Cygwin
From: |
Bruno Haible |
Subject: |
Re: [PATCH] fchmodat: Use /proc on Cygwin |
Date: |
Thu, 23 Jul 2020 23:16:27 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-179-generic; KDE/5.18.0; x86_64; ; ) |
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 <bruno@clisp.org>
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);