realpath returns NULL for broken symlinks

Luciano Miguel Ferreira Rocha strange at nsk.no-ip.org
Mon Feb 12 19:05:42 UTC 2007


On Thu, Feb 08, 2007 at 11:56:11PM -0500, Mike Frysinger wrote:
> good point ... i thought glibc did return a value and not NULL, but i just 
> tested it and indeed our behavior matches that of glibc (broken symlink 
> returns NULL)

FWIW, realpath in Darwin behaviour is different:

$ man realpath
...
All but the last component of pathname must exist when realpath() is called.
...

$ # /dev/log points to non-existant /tmp/log
$ ./realpath /tmp/nosuchfile /dev/log
/tmp/nosuchfile -> /private/tmp/nosuchfile
/dev/log -> /private/tmp/log

On glibc, ENOENT returns NULL.

> so back to the drawing board ... what's the trouble with new realpath 
> implementation in busybox ...

Busybox should do the unlink only if realpath didn't return NULL.

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20070212/56049b21/attachment-0002.pgp 


More information about the uClibc mailing list