hard links: how to tell with system call under BSD4.3?

Robert Earl rearl at gnu.ai.mit.edu
Sat May 11 09:00:24 AEST 1991


In article <1991May10.210452.28889 at ux1.cso.uiuc.edu> phil at ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes:

|   So this is why there is no indicator of hard links.  EVERY name is in fact
|   a hard link.  However you cannot do multiple hard links to the same inode
|   if that inode is a symlink (soft link) or a directory (unless your system
|   is broken as mine is).

The superuser can generally make hard links to directories, and a bug
involving rename() in sticky directories on some systems seems to
allow users to end up with hardlinked directories, whether they like it
or not...

|   Check for the link count.  That will tell you how many names the file has.
|   For a directory it should always be 2, one for the parent pointing to it and
|   one for it's own "." file.

Well, no, for each subdirectory made, a parent directory shows one
more link.  (From the ".." entry in the child).  For example, my home
directory has 11 links.


--robert



More information about the Comp.unix.programmer mailing list