Hi Ken,

> > 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

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


Reply via email to