[lxc-devel] [PATCH] Attempt to fix control tty issues on attach
Serge Hallyn
serge.hallyn at ubuntu.com
Fri Mar 13 23:03:16 UTC 2015
Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> src/lxc/attach.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/src/lxc/attach.c b/src/lxc/attach.c
> index f70e42e..faa90fc 100644
> --- a/src/lxc/attach.c
> +++ b/src/lxc/attach.c
> @@ -984,6 +984,21 @@ static int attach_child_main(void* data)
> if (options->gid != (gid_t)-1)
> new_gid = options->gid;
>
> + /* setup the control tty */
> + if (options->stdin_fd) {
> + if (setsid() < 0) {
> + SYSERROR("unable to setsid");
> + shutdown(ipc_socket, SHUT_RDWR);
> + rexit(-1);
> + }
> +
> + if (ioctl(options->stdin_fd, TIOCSCTTY, (char *)NULL) < 0) {
> + SYSERROR("unable to TIOCSTTY");
> + shutdown(ipc_socket, SHUT_RDWR);
> + rexit(-1);
> + }
> + }
> +
> /* try to set the uid/gid combination */
> if ((new_gid != 0 || options->namespaces & CLONE_NEWUSER)) {
> if (setgid(new_gid) || setgroups(0, NULL)) {
> --
> 1.9.1
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list