Call selinux_restore_tty() as part of cleanup() so it gets called
from error()/errorx()
This commit is contained in:
@@ -121,6 +121,9 @@ cleanup(int gotsignal)
|
|||||||
{
|
{
|
||||||
if (!tq_empty(&io_plugins))
|
if (!tq_empty(&io_plugins))
|
||||||
term_restore(io_fds[SFD_USERTTY], 0);
|
term_restore(io_fds[SFD_USERTTY], 0);
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
selinux_restore_tty();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -66,7 +66,6 @@ static struct selinux_state {
|
|||||||
*
|
*
|
||||||
* Returns zero on success, non-zero otherwise
|
* Returns zero on success, non-zero otherwise
|
||||||
*/
|
*/
|
||||||
/* XXX - should also be called as part of cleanup() */
|
|
||||||
int
|
int
|
||||||
selinux_restore_tty(void)
|
selinux_restore_tty(void)
|
||||||
{
|
{
|
||||||
@@ -91,9 +90,14 @@ selinux_restore_tty(void)
|
|||||||
warning("unable to restore context for %s", se_state.ttyn);
|
warning("unable to restore context for %s", se_state.ttyn);
|
||||||
|
|
||||||
skip_relabel:
|
skip_relabel:
|
||||||
if (se_state.ttyfd != -1)
|
if (se_state.ttyfd != -1) {
|
||||||
close(se_state.ttyfd);
|
close(se_state.ttyfd);
|
||||||
|
se_state.ttyfd = -1;
|
||||||
|
}
|
||||||
|
if (chk_tty_context != NULL) {
|
||||||
freecon(chk_tty_context);
|
freecon(chk_tty_context);
|
||||||
|
chk_tty_context = NULL;
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user