How to determine file being redirected to in C

Guy Harris guy at auspex.UUCP
Thu Mar 2 06:14:46 AEST 1989


 >Use the stat() and fstat() functions, then compare the inode numbers 
 >in the structure.  If they are the same then the two files are identical.

Wrong.  If the inode numbers (st_ino) *AND* the file system IDs (st_dev)
are the same, then the two files are identical.  If just the inode
numbers are the same, you can't conclude anything about whether the
files are the same or not.  They could have the same inode number but be
on two different file systems; inode numbers are *not* unique across
file systems.



More information about the Comp.unix.questions mailing list