diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-19 01:44:08 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-19 01:44:08 +0000 |
commit | 4096c5fd0c73a5ad65e52c940556227443e6eba7 (patch) | |
tree | 755a1190e4688e19732f8fdca712fe23ac269838 /sys/kern | |
parent | 3543e4bd79f623fa87789145e5d711d58ea43a2f (diff) |
Set atime and mtime when giving out a new pty. With help from tholo@
and OK tedu@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/tty_pty.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index b55572b59c8..38f69dfe617 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_pty.c,v 1.26 2004/12/07 03:42:45 pat Exp $ */ +/* $OpenBSD: tty_pty.c,v 1.27 2004/12/19 01:44:07 millert Exp $ */ /* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */ /* @@ -1043,9 +1043,10 @@ pty_getfree(void) static int ptm_vn_open(struct nameidata *ndp) { - struct vnode *vp; struct proc *p = ndp->ni_cnd.cn_proc; struct ucred *cred; + struct vattr vattr; + struct vnode *vp; int error; if ((error = namei(ndp)) != 0) @@ -1061,6 +1062,14 @@ ptm_vn_open(struct nameidata *ndp) */ cred = crget(); error = VOP_OPEN(vp, FREAD|FWRITE, cred, p); + if (!error) { + /* update atime/mtime */ + VATTR_NULL(&vattr); + getnanotime(&vattr.va_atime); + vattr.va_mtime = vattr.va_atime; + vattr.va_vaflags |= VA_UTIMES_NULL; + (void)VOP_SETATTR(vp, &vattr, p->p_ucred, p); + } crfree(cred); if (error) |