freebsd-dev/usr.bin/fstat
Andriy Gapon 497e910cd3 fstat: fix fsid comparison when executed on systems with 64-bit long
This affects only fstat on zfs and devfs, only on 64-bit systems
and only when fsid is greater than 2^31 - 1.
When fstat examines a file via stat(2) it takes uint32_t st_dev
and assigns to (signed) (64-bit) long fsid, this results in
a positive value.
When fstat examines opened files it takes int32_t f_fsid.val[0]
and assigns to (signed) (64-bit) long fsid, this results in
a negative value.
So, while initially st_dev and f_fsid.val[0] have the same bit
values they get promoted to different 64-bit values because
of the signed-vs-unsigned difference.

A fix is to use "more natural" positive numbers by introducing
intermediate unsigned cast for f_fsid.val[0].

Reviewed by:	jhb, lulf
Approved by:	re (kib)
MFC after:	1 week (to stable/7)
2009-08-20 10:57:14 +00:00
..
zfs Merge latest DTrace changes from Perforce. 2008-11-05 19:39:37 +00:00
cd9660.c Dike out another kvm indiscretion. 2005-03-16 10:24:16 +00:00
fstat.1 Add manual page links to advertise procstat(1) a little better. 2009-07-09 16:40:00 +00:00
fstat.c fstat: fix fsid comparison when executed on systems with 64-bit long 2009-08-20 10:57:14 +00:00
fstat.h - Add ZFS-support to fstat(1). This allows ZFS-filsystems to be including in 2007-11-05 23:15:03 +00:00
Makefile Don't depend on the modification time of the "zfs" subdir. 2008-04-29 06:54:12 +00:00
msdosfs.c Fix compilation of fstat. 2009-02-28 10:40:37 +00:00
zfs.c fstat: fix fsid comparison when executed on systems with 64-bit long 2009-08-20 10:57:14 +00:00