[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: |
Fri, 24 Jul 2020 00:36:23 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-179-generic; KDE/5.18.0; x86_64; ; ) |
Hi Ken,
> > 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);
>
> Yes, that should work. Can you tell me how to test it? I've never had
> occasion
> to use Gnulib except indirectly
I tested it by running
rm -rf ../testdir
./gnulib-tool --create-testdir --dir=../testdir --single-configure lchmod
fchmodat
then transporting that testdir to my Cygwin machine, and building there
(./configure && make && make check).
There is a unit test (test-lchmod.c); I assume that it exercises the main case.
Of course I did so before pushing my change.
Bruno