Better realpath

Vladimir Prus vladimir@codesourcery.com
Sat Jun 14 12:14:00 GMT 2008


On Saturday 14 June 2008 14:31:32 Pierre Muller wrote:
> I just looked at your patch and the idea seems
> good... But I am no expert on this field.
> 
>   One question though, libiberty lrealpath
> function uses strdup, while the replaced 
> code uses xstrdup.
>   xstrdup is also defined in libiberty
> as being a replacement of strdup that never
> fails... (didn't really get how this is
> possible...)
> 
>   Anyhow, is this a potential issue?

I don't think so. xstrdup is supposed to fail if it cannot get enough
memory. lrealpath, as it is now, will return NULL, but with my patch, 
there's a check for that in gdb_realpath -- and a call to nomem.

(And no, I did not think about that myself -- Dan suggested the
check and the call to nomem).

- Volodya



More information about the Gdb-patches mailing list