[lxc-devel] [PATCH] attach: don't ignore sigint/sigkill if stdin is redirected

Stéphane Graber stgraber at ubuntu.com
Wed Oct 29 15:22:20 UTC 2014


On Wed, Oct 29, 2014 at 03:03:14PM +0000, Serge Hallyn wrote:
> If attach is being done over passed-in fds, then we shouldn't
> mess with the caller's signal table to ignore ctrl-c over the
> fd.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/attach.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lxc/attach.c b/src/lxc/attach.c
> index 2318018..4010668 100644
> --- a/src/lxc/attach.c
> +++ b/src/lxc/attach.c
> @@ -758,8 +758,10 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
>  		}
>  
>  		/* ignore SIGKILL (CTRL-C) and SIGQUIT (CTRL-\) - issue #313 */
> -		signal(SIGINT, SIG_IGN);
> -		signal(SIGQUIT, SIG_IGN);
> +		if (options->stdin_fd == 0) {
> +			signal(SIGINT, SIG_IGN);
> +			signal(SIGQUIT, SIG_IGN);
> +		}
>  
>  		/* reap intermediate process */
>  		ret = wait_for_pid(pid);
> -- 
> 2.1.0
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20141029/3a35276b/attachment.sig>


More information about the lxc-devel mailing list