[RFA] Should openp open directories?

Eli Zaretskii eliz@is.elta.co.il
Thu Apr 18 08:17:00 GMT 2002


On Thu, 18 Apr 2002, Joel Brobecker wrote:

> 2002-04-18  Joel Brobecker  <brobecker@gnat.com>
> 
>         * source.c (is_regular_file): New function.
>         (openp): Check wether file to open is a regular file
>         to avoid opening directories.

I think this change is a good idea, but I have one comment: if stat 
fails, isn't it better to return non-zero?  Yes, I know: it shouldn't 
happen, but if we return non-zero in that case, we keep 
back-compatibility in case there are some obscure filesystems when that 
could happen.

Also, did you try your patch when there's a directory by that name, but 
no executable program?  If so, what does the patched GDB say and/or do?



More information about the Gdb-patches mailing list