[lxc-devel] [PATCH] ignore SIGKILL (CTRL-C) and SIGQUIT (CTRL-\) - issue #313

Serge Hallyn serge.hallyn at ubuntu.com
Fri Aug 22 18:53:42 UTC 2014


Quoting S.Çağlar Onur (caglar at 10ur.org):
> Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>
> ---

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

>  src/lxc/attach.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/attach.c b/src/lxc/attach.c
> index 1a753c7..923c497 100644
> --- a/src/lxc/attach.c
> +++ b/src/lxc/attach.c
> @@ -26,6 +26,7 @@
>  #include <stdio.h>
>  #include <string.h>
>  #include <stdlib.h>
> +#include <signal.h>
>  #include <errno.h>
>  #include <fcntl.h>
>  #include <grp.h>
> @@ -601,7 +602,7 @@ static bool fetch_seccomp(const char *name, const char *lxcpath,
>  		struct lxc_proc_context_info *i, lxc_attach_options_t *options)
>  {
>  	struct lxc_container *c;
> -	
> +
>  	if (!(options->namespaces & CLONE_NEWNS) || !(options->attach_flags & LXC_ATTACH_LSM))
>  		return true;
>  
> @@ -771,6 +772,10 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
>  			goto cleanup_error;
>  		}
>  
> +		/* ignore SIGKILL (CTRL-C) and SIGQUIT (CTRL-\) - issue #313 */
> +		signal(SIGINT, SIG_IGN);
> +		signal(SIGQUIT, SIG_IGN);
> +
>  		/* reap intermediate process */
>  		ret = wait_for_pid(pid);
>  		if (ret < 0)
> -- 
> 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