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


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.

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


r~


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