This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libfortran] Use access(2) instead of stat(2) to test file existence


Thanks for taking the time to look at the patch.

On Mon, Aug 2, 2010 at 19:29, Richard Henderson <rth@redhat.com> wrote:
> On 07/31/2010 03:41 PM, Janne Blomqvist wrote:
>> + Âif ((mode & R_OK) && open (path, O_RDONLY) < 0)
>> + Â Âreturn -1;
>> +
>> + Âif ((mode & W_OK) && open (path, O_WRONLY) < 0)
>> + Â Âreturn -1;
>
> You're leaking file descriptors here.

Yes, I realized that, however, as this is not actually code that I
wrote as part of this patch I decided to leave it for later. I just
moved the entire function upwards in the file before all users, hence
it showed up in the diff. fallback_access() has been around since
2007, see PR 21185.

In any case, I filed PR 45165 to keep track of this issue.

> Since you're not using [RW]_OK, better to just remove those cases.

It is used by unix.c:inquire_access() and callers of that function.

-- 
Janne Blomqvist


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]