This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: [PATCH] fstat() problem in libc/rexec.cc
- From: "Charles Wilson" <cygwin at cwilson dot fastmail dot fm>
- To: cygwin-patches at cygwin dot com
- Date: Mon, 06 Apr 2009 18:31:09 -0400
- Subject: Re: [PATCH] fstat() problem in libc/rexec.cc
Corinna Vinschen wrote:
>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 :}
I think this should also fix the (long-standing) problem documented in
the rexecd section of /usr/share/doc/Cygwin/inetutils*README:
I verified that the REXEC_USER/REXEC_PASS variables work, but
cygwin's rcmd() implementation is problematic. It complained that my
~/.netrc file was readable by others, and refused to use it; however,
the permissions were 0600. I did not track this down further.
--
Chuck