Do we really need correct st_nlink count for directories?
Eric Blake
ebb9@byu.net
Sat Apr 26 03:21:00 GMT 2008
According to Igor Peshansky on 4/25/2008 2:25 PM:
>> When link counts are accurate, every directory has a link count of at
>> least 2 (. and ..)
>
> I thought leaf directories had a legitimate link count of 1.
Two, actually: ".", but also the entry in ".." that points to the
directory's inode. There might be some alternative file systems where
readdir() omits . and .. in its list, leaving a link count of 0. But I've
never seen a disk-based link count of 1. And even Linux uses 1, not 0, as
the link count of FAT directories. A directory with a link count of 2 is
guaranteed to be a leaf directory (no subdirs); but with a link count of 1
is indeterminate.
--
Don't work too hard, make some time for fun as well!
Eric Blake ebb9@byu.net
More information about the Cygwin-developers
mailing list