]> git.ipfire.org Git - thirdparty/lxc.git/commit
lxc-attach: attach even without sigwinch handler 951/head
authorChristian Brauner <christian.brauner@mailbox.org>
Thu, 7 Apr 2016 15:10:20 +0000 (17:10 +0200)
committerChristian Brauner <christian.brauner@mailbox.org>
Thu, 7 Apr 2016 19:01:18 +0000 (21:01 +0200)
commit341c2aed462c64e98a083b9ecd2e519ef4104cfd
tree40a80b178723a7212094896d3005675de563646b
parent823765e50bf4df2f2365bd2590768676634919b7
lxc-attach: attach even without sigwinch handler

lxc_console_create() calls lxc_console_peer_default() which in turn calls
lxc_console_sigwinch_init() which sets up the lxc_tty_state struct for the
current pty. Prior to this commit lxc_console_sigwinch_init() would consider
failures to install a SIGWINCH handler fatal and and return NULL. This commit
makes failures to install a SIGWINCH handler non-fatal. In such cases the
lxc_tty_state struct will still be set up but the sigfd member, which contains
the fd which receives SIGWINCH events, will be set to -1. (This also entails
that the sigset_t oldmaks field is meaningless.) Callers of
lxc_console_sigwinch_init() and lxc_console_sigwinch_fini() should thus make
sure that sigfd >= 0 or sigfd != -1 before trying to register a SIGWINCH handler
in e.g. an lxc_mainloop or resetting the sigmask (cf. lxc_attach.c).

These changes also imply that lxc_console_sigwinch_init() only fails with
ENOMEM. Thus, all cases where lxc_console_sigwinch_init() returns NULL are to be
considered fatal. This wasn't the case before this commit.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
src/lxc/console.c
src/lxc/console.h
src/lxc/lxc_attach.c