S_IFCHR is not a bit mask, it's just a value in a field. The correct

way to clear that field is to use S_IFMT.

Pointed out by BDE.
This commit is contained in:
Paul Richards 2001-06-04 03:39:14 +00:00
parent f20688d55c
commit 34c4099770

View File

@ -124,7 +124,7 @@ newstat_copyout(struct stat *buf, void *ubuf)
(dev = udev2dev(buf->st_rdev, 0)) != NODEV) {
cdevsw = devsw(dev);
if (cdevsw != NULL && (cdevsw->d_flags & D_DISK)) {
tbuf.stat_mode &= ~S_IFCHR;
tbuf.stat_mode &= ~S_IFMT;
tbuf.stat_mode |= S_IFBLK;
/* XXX this may not be quite right */