If /dev/tty gets opened after your controlling terminal has been revoked
you can't call tty_clone afterwords. OpenBSD and NetBSD both fail the open call in that case, so we should do so as well. This can be done in ctty_clone by returning with *dev==NULL. Admittedly this causes open to return ENOENT, instead of ENXIO as on the other BSDs, but this way requires the least touching of code. Submitted by: Nate Eldredge <nge@cs.hmc.edu> PR: 83375 MFC: 1 week
This commit is contained in:
parent
07a8ebcc75
commit
153c21c8c1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162573
@ -64,7 +64,11 @@ ctty_clone(void *arg, struct ucred *cred, char *name, int namelen,
|
||||
*dev = ctty;
|
||||
else if (curthread->td_proc->p_session->s_ttyvp == NULL)
|
||||
*dev = ctty;
|
||||
else
|
||||
else if (curthread->td_proc->p_session->s_ttyvp->v_type == VBAD ||
|
||||
curthread->td_proc->p_session->s_ttyvp->v_rdev == NULL) {
|
||||
/* e.g. s_ttyvp was revoked */
|
||||
return;
|
||||
} else
|
||||
*dev = curthread->td_proc->p_session->s_ttyvp->v_rdev;
|
||||
dev_ref(*dev);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user