On Sun, Jul 21, 2002 at 01:47:39AM +0100, Paul Jakma wrote:
> On Sat, 20 Jul 2002, kevin lyda wrote:
>> anyway, links are directory entries that reference the same inode.
> (and i'll bet the restriction on directories is an artificial these
> days.. ELOOP exists anyway because of symlinks.)
Nope, it's not artificial. When you're dealing with symlinks you know
they're symlinks, so you can easily count them. E.g.:
$ mkdir foo; cd foo; ln -s ../foo bar; cd bar/bar/bar/bar . . .
The kernel can just increment the symlink count and return ELOOP if
necessary. But if you hardlink to a directory then the directory's
inode will tell you that it's a directory (which it is). You'll have
to cache the inodes traversed in reaching the current inode and search
the list each time, or take some similar approach to detect loops.
You could just not perform loop detection and rely on ENAMETOOLONG
"That would preempt a bunch of problems involved in trying to reconstruct
exactly how the Perl 5 parser thinks, which nobody entirely understands."
Larry Wall, 2001/04/20, perl6-language at perl.org
"Finger to spiritual emptiness underlying everything." -- How a Japanese C
manual referred to a "pointer to void".
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!