Mail Archives: djgpp/1997/08/31/12:15:52
On Fri, 29 Aug 1997, Thomas Demmer wrote:
> Eli Zaretskii wrote:
>
> > Another way would be to call `stat' on both files and compare the
> > st_dev and st_ino members of struct stat: if both of them are
> > identical, the two names refer to the same file.
>
> I think this is not correct:
> stat() invents inodes for networked drives, i.e. it
> counts upwards from 65536. It remembers which filenames it has
> seen before, so that two calls to stat() with the identical
> name yields identical results. In the example above, however,
> the names are not identical.
`stat' remembers the name as it was returned by `_truename', otherwise
even "m:foo" and "m:/dir/subdir/foo" would not yield the same inode.
Since `_truename' is supposed to return UNCs in the case of networked
drives, `stat' should indeed work as I described.
> What should work is something like
>
> _fixpath(fn1, fixed_fn1);
> _fixpath(fn2, fixed_fn2);
> _truename(fixed_fn1,canon_path1);
> _truename(fixed_fn2,canon_path2);
`_truename' doesn't need `_fixpath' to be called before it, it does all
the work itself.
- Raw text -