This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Should openp open 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.
It seems a sensible idea to return True when stat fails, except when the
file does not exist. I suggest the new following implementation (rough
code, not compiled):
status = stat (filename, &st);
/* A comment here explaining why we return true when errno != ENOENT.
Or maybe in the function description ??? */
if (status != 0)
return (errno != ENOENT);
What do you think?
> 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?
Yes. I tried "./gdb/gdb bfd" at the root of the gdb source directory and
got the following error message:
bfd: No such file or directory.
The "or directory" part may be confusing...
--
Joel