arn...@skeeve.com wrote:
Testing for same inode is likely to work but not guaranteed. I think
it'd be better to compare the major and minor device numbers on the two
stat buffers. If they're equal then you know for sure you have a null
device in hand.

I considered that, but major and minor device number checking is less portable, whereas inode-number checking should be quite portable (it is the approach used by GNU cmp, which also optimizes the case for stdout being /dev/null). In practice it's so rare to have two different inodes that both resolve to the null device, that it's probably not worth worrying about the porting hassle to optimize for that special case. (There's also NFS to worry about...)



Reply via email to