diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-07-16 18:25:44 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-07-16 18:25:44 +0000 |
commit | f1a2dff38086a5f1880eabe12b41936905f2e64e (patch) | |
tree | a4902e3d26408de902fe5ca3cc0cbeb1f4eee837 /sys | |
parent | 954d5b62e09abbc818b669e2acf5eebe62ddc4dc (diff) |
Ignore O_TRUNC on open() if we are not opening a regular file.
csapuntz@ OK'd
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_vnops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 27a7a37a1c6..6db663d3eaf 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.32 2001/06/27 04:49:48 art Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.33 2001/07/16 18:25:43 millert Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -156,7 +156,7 @@ vn_open(ndp, fmode, cmode) goto bad; } } - if (fmode & O_TRUNC) { + if ((fmode & O_TRUNC) && vp->v_type == VREG) { VOP_UNLOCK(vp, 0, p); /* XXX */ VOP_LEASE(vp, p, cred, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); /* XXX */ |