1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-28 11:57:28 +00:00

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:
Bruce M Simpson 2008-05-03 02:29:02 +00:00
parent 03bc210eb9
commit a0ad4c4d37
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178736
4 changed files with 12 additions and 0 deletions

View File

@ -666,6 +666,7 @@ tipabort(char *msg)
daemon_uid();
(void)uu_unlock(uucplock);
unraw();
unexcl();
exit(0);
}

View File

@ -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;
/*

View File

@ -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);

View File

@ -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));
}