[PATCH] fstat() problem in libc/rexec.cc

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Apr 6 20:51:00 GMT 2009

Hi Earl,

On Apr  6 13:20, Earl Chew wrote:
> The current implementation of rexec() uses fstat() and it seems
> to pick up the wrong values for st_mode. As a consequence
> the code keeps complaining about the permissions for ~/.netrc
> and won't complete successfully.
> I don't know enough about the how the re-mapping of stat/stat64
> works within cygwin1.dll itself, but changing to fstat64()
> like libc/iruserok.c resolves the problem.

That's exactly the right thing to do.  The mapping from fstat to fstat64
only works for applications and libs linked against Cygwin, not within
Cygwin itself.  So the call to fstat in rexec calls the old fstat
function which uses the old backward compatible style struct stat with
different member sizes.  This explains that the mode bits are not
correct.  I really thought I had catched them all, but this slipped
through my cracks, apparently :}

> winsup/cygwin/Changlog
>     * libc/rexec.cc: Use fstat64() instead of fstat().

Patch applied.

Thank you,

Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list