Xref: utzoo comp.unix.questions:11944 comp.unix.xenix:5166 Path: utzoo!attcan!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.unix.questions,comp.unix.xenix Subject: Re: How to determine file being redirected to in C Keywords: redirection Message-ID: <1105@auspex.UUCP> Date: 1 Mar 89 20:14:46 GMT References: <10@sherpa.UUCP> <475@ispi.UUCP> Reply-To: guy@auspex.UUCP (Guy Harris) Distribution: na Organization: Auspex Systems, Santa Clara Lines: 10 >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.