realpath returns NULL for broken symlinks

Luciano Miguel Ferreira Rocha strange at nsk.no-ip.org
Thu Feb 8 13:57:55 PST 2007


On Thu, Feb 08, 2007 at 04:41:04PM -0500, Mike Frysinger wrote:
> On Thursday 08 February 2007, Mike Frysinger wrote:
> > so the answer is that realpath() on a broken symlink returns NULL when it
> > should not ... realpath() on symlinks that are not broken work fine
> 
> my reading of the POSIX spec says this is the correct behavior
> 
> http://www.opengroup.org/onlinepubs/009695399/functions/realpath.html
> char *realpath(const char *restrict file_name, char *restrict resolved_name);
> ERRORS
> 	[ENOENT] a component of file_name does not name an existing file
> 

Personally, I read that as specific to components leading to the file.
Ie., /a/b/c/d -> /a, /a/b and /a/b/c.

That what makes sense in [EACCES] and [ENOTDIR]. Also from the
description: "whose resolution does not involve '.', '..', or symbolic
links." (So, whether the pointed file exists or not isn't relevant.)

Is there any reference on the spec about the definitive meaning of
"component"?

-- 
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://busybox.net/lists/uclibc/attachments/20070208/1ffaa569/attachment.pgp 


More information about the uClibc mailing list