diff options
author | 1999-03-09 21:16:28 +0000 | |
---|---|---|
committer | 1999-03-09 21:16:28 +0000 | |
commit | a0890cd86cdbbb156fc1fe089b74fae8e7b5aea4 (patch) | |
tree | 03cf97ecf702cadaea68319008206767721417b2 | |
parent | If /etc/ppp/ppp.conf doesn't exist, mention that the (diff) | |
download | wireguard-openbsd-a0890cd86cdbbb156fc1fe089b74fae8e7b5aea4.tar.xz wireguard-openbsd-a0890cd86cdbbb156fc1fe089b74fae8e7b5aea4.zip |
POSIX says:
If O_TRUNC is set and the file did previously exist, upon successful
completion the open() function shall mark for update the st_ctime and st_mtime
fields of the file.
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 9e13ad2e2ca..5575728b316 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.26 1999/02/26 05:55:10 millert Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.27 1999/03/09 21:16:28 art Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -184,14 +184,19 @@ ufs_open(v) int a_mode; struct ucred *a_cred; struct proc *a_p; - } */ *ap = v; + } */ *ap = v; + struct inode *ip = VTOI(ap->a_vp); /* * Files marked append-only must be opened for appending. */ - if ((VTOI(ap->a_vp)->i_ffs_flags & APPEND) && + if ((ip->i_ffs_flags & APPEND) && (ap->a_mode & (FWRITE | O_APPEND)) == FWRITE) return (EPERM); + + if (ap->a_mode & O_TRUNC) + ip->i_flag |= IN_CHANGE | IN_UPDATE; + return (0); } |