if (sigprocmask(SIG_BLOCK, &mask, &ts->oldmask)) {
SYSERROR("failed to block SIGWINCH");
ts->sigfd = -1;
+ lxc_list_del(&ts->node);
return ts;
}
SYSERROR("failed to create signal fd");
sigprocmask(SIG_SETMASK, &ts->oldmask, NULL);
ts->sigfd = -1;
+ lxc_list_del(&ts->node);
return ts;
}
void lxc_console_sigwinch_fini(struct lxc_tty_state *ts)
{
- if (ts->sigfd >= 0)
+ if (ts->sigfd >= 0) {
close(ts->sigfd);
+ lxc_list_del(&ts->node);
+ sigprocmask(SIG_SETMASK, &ts->oldmask, NULL);
+ }
- lxc_list_del(&ts->node);
- sigprocmask(SIG_SETMASK, &ts->oldmask, NULL);
free(ts);
}
static void lxc_console_peer_proxy_free(struct lxc_console *console)
{
- if (console->tty_state && console->tty_state->sigfd != -1) {
+ if (console->tty_state) {
lxc_console_sigwinch_fini(console->tty_state);
console->tty_state = NULL;
}
err4:
lxc_mainloop_close(&descr);
err3:
- if (ts->sigfd != -1)
- lxc_console_sigwinch_fini(ts);
+ lxc_console_sigwinch_fini(ts);
err2:
close(masterfd);
close(ttyfd);