realpath bug

Marc Leeman marc.leeman at gmail.com
Thu Feb 8 12:51:56 UTC 2007


> I attach a suggested patch. Please let me know if the solution is correct.

> -                return NULL;
> +                return resolved_path;

I encountered this problem with a syslogd rewrite in busybox
1.4.0/1.4.1 where the function xmalloc_realpath depends on the return
value of realpath. The re-write is correct, but it lets a uclibc bug
surface.

Since it always returns NULL; syslogd breaks on (buildroot generated)
read only filesystems.

busybox assumed the behaviour that is defined in the man page of
realpath where NULL is returned when realpath fails (and
"resolved_path" is undetermined) and otherwise returns a pointer to
"resolved_path".

Your patch fixes this omission in uclibc. From the manpage:

RETURN VALUE
If there is no error, realpath() returns a pointer to the resolved_path.

Otherwise it returns a NULL pointer, and the contents of the array
resolved_path are undefined.



More information about the uClibc mailing list