diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-07-16 02:56:49 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-07-16 02:56:49 +0000 |
commit | 67cbfeff543fa0a4aaf0cc1dd670ea78e54c302c (patch) | |
tree | 171acffa199af0e055ddf601708cebb058025166 /sys/ufs/ffs | |
parent | 90290729d4a4e905d96796442cd478bd4aef5915 (diff) |
Don't try to truncate anything except for symlinks, directories, and
regular files.
ftruncate and truncate that go through FFS/EXT2FS/MFS will now return
EINVAL when done on devices.
Bug introduced when VOP_TRUNCATE was removed, thus removing spec_truncate.
Thanks to millert@ for tracking this one down.
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index c3ba0924d4d..abb7374e44a 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_inode.c,v 1.21 2001/06/27 04:58:48 art Exp $ */ +/* $OpenBSD: ffs_inode.c,v 1.22 2001/07/16 02:56:48 csapuntz Exp $ */ /* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */ /* @@ -165,6 +165,12 @@ ffs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred) if (length < 0) return (EINVAL); ovp = ITOV(oip); + + if (ovp->v_type != VREG && + ovp->v_type != VDIR && + ovp->v_type != VLNK) + return (EINVAL); + if (oip->i_ffs_size == length) return (0); if (ovp->v_type == VLNK && |