[lxc-devel] [PATCH] lxc-checkpoint: close stdout/stdin when daemonizing

Serge Hallyn serge.hallyn at ubuntu.com
Wed Oct 1 20:41:36 UTC 2014


Quoting Tycho Andersen (tycho.andersen at canonical.com):
> If we don't close these running lxc-checkpoint via:
> 
> ssh host "sudo lxc-checkpoint ..."
> 
> just hangs. We leave stderr open so that subesquent errors will print correctly
> (and also because for whatever reason it doesn't break ssh :).
> 
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>

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

> ---
>  src/lxc/lxc_checkpoint.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/lxc/lxc_checkpoint.c b/src/lxc/lxc_checkpoint.c
> index 698e434..cfa08fc 100644
> --- a/src/lxc/lxc_checkpoint.c
> +++ b/src/lxc/lxc_checkpoint.c
> @@ -154,6 +154,11 @@ bool restore(struct lxc_container *c)
>  		pid = fork();
>  
>  	if (pid == 0) {
> +		if (my_args.daemonize) {
> +			close(0);
> +			close(1);
> +		}
> +
>  		ret = c->restore(c, checkpoint_dir, verbose);
>  
>  		if (!ret) {
> -- 
> 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