Relinquish exclusive TTY access when tip(1) or cu(1) exit.
Previously they would have left TIOCEXCL enabled, requiring either a reboot or use of tip/cu as the root user. Observed when running QEMU with character devices redirected to pty instances. MFC after: 2 weeks
This commit is contained in:
parent
c683ca0c36
commit
b1c6637111
@ -666,6 +666,7 @@ tipabort(char *msg)
|
||||
daemon_uid();
|
||||
(void)uu_unlock(uucplock);
|
||||
unraw();
|
||||
unexcl();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -325,6 +325,15 @@ unraw(void)
|
||||
tcsetattr(0, TCSADRAIN, &defterm);
|
||||
}
|
||||
|
||||
/*
|
||||
* give up exclusive tty access
|
||||
*/
|
||||
void
|
||||
unexcl()
|
||||
{
|
||||
ioctl(FD, TIOCNXCL, 0);
|
||||
}
|
||||
|
||||
static jmp_buf promptbuf;
|
||||
|
||||
/*
|
||||
|
@ -341,6 +341,7 @@ void timeout(int);
|
||||
void tipabort(char *);
|
||||
void tipout(void);
|
||||
void user_uid(void);
|
||||
void unexcl(void);
|
||||
void unraw(void);
|
||||
void v3451_abort(void);
|
||||
void v3451_disconnect(void);
|
||||
|
@ -126,5 +126,6 @@ uu_unlock(char *ttyname)
|
||||
char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
|
||||
|
||||
(void)snprintf(tbuf, sizeof tbuf, _PATH_LOCKDIRNAME, ttyname);
|
||||
unexcl();
|
||||
return(unlink(tbuf));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user