Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!sarah!cs.albany.edu!crdgw1!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!think.com!mintaka!ai-lab!life.ai.mit.edu!rearl From: rearl@gnu.ai.mit.edu (Robert Earl) Newsgroups: comp.unix.programmer Subject: Re: hard links: how to tell with system call under BSD4.3? Message-ID: Date: 10 May 91 23:00:24 GMT References: <1991May10.013347.8621@athena.mit.edu> <1991May10.210452.28889@ux1.cso.uiuc.edu> Sender: news@ai.mit.edu Distribution: usa Organization: (EVIL!) Lines: 22 In-reply-to: phil@ux1.cso.uiuc.edu's message of 10 May 91 21:04:52 GMT In article <1991May10.210452.28889@ux1.cso.uiuc.edu> phil@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