Are links as useful as they could be?
guy at sun.UUCP
guy at sun.UUCP
Tue Oct 7 18:14:50 AEST 1986
> The "check for looping" could be fixed for symbolic links by defining
> some primitive that converts a filename into the filename that it
> "really is" -- ie, it does the work that it does internally in order
> to do things like open(), execle(), etc... on a symbolic link.
Huh? The "check for looping" is there to prevent calls like "open" from
looping:
ln -s a b
ln -s b a
cat a
I presume the primitive you're referring to would be something like:
int evaluatelink(const char *path, char *buf, int buflen);
which would take the path pointed to by "path" and return the path name of
the file it ultimately refers to in the buffer whose first character is
pointed to by "buf", transferring at most "buflen" characters.
How would this help? If that primitive does the work that the kernel does
internally for things like "open", it would have the same problems as those
calls, and would have to do the same check for looping.
> lstat() is fine but it only does one level of translation.
Huh? "lstat" does *no* translation; that's what it's there for. It finds
the file referred to by the path argument, assuming *no* symbolic-link
translation, and returns its file status. "stat" does symbolic-link
translation.
--
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
guy at sun.com (or guy at sun.arpa)
More information about the Comp.unix
mailing list