Bit pattern of S_IFREG (was Re: What is wrong with this code ?)

Guy Harris guy at auspex.UUCP
Tue Dec 19 10:32:39 AEST 1989


>I think I have seen on some older systems, that for regular files
>you must test for both	(st_mode & S_IFMT) == S_IFREG
>and *additionally*	(st_mode & S_IFMT) == 0.
>
>I don't know if this is still true today.

If it is true on any "V7 derivative" (BSD and S3/S5 count under this
heading), it is due to a colossal screwup on the part of the vendor.  It
may have been true under some emulation of V7 under "last V6", or
something like that.  *I* certainly wouldn't bother testing for
(st_mode & S_IFMT) being 0.



More information about the Comp.unix.questions mailing list