[lxc-devel] [PATCH] c/r: remember to clean up pidfile

Serge Hallyn serge.hallyn at ubuntu.com
Tue Jun 2 16:29:42 UTC 2015


Quoting Tycho Andersen (tycho.andersen at canonical.com):
> When restoring, we didn't clean up the pidfile that criu uses to pass us the
> init pid on error or success; let's do that.
> 
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>

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

> ---
>  src/lxc/criu.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/lxc/criu.c b/src/lxc/criu.c
> index 1913473..d45c96c 100644
> --- a/src/lxc/criu.c
> +++ b/src/lxc/criu.c
> @@ -526,6 +526,9 @@ void do_restore(struct lxc_container *c, int pipe, char *directory, bool verbose
>  
>  				ret = fscanf(f, "%d", (int*) &handler->pid);
>  				fclose(f);
> +				if (unlink(pidfile) < 0 && errno != ENOENT)
> +					SYSERROR("unlinking pidfile failed");
> +
>  				if (ret != 1) {
>  					ERROR("reading restore pid failed");
>  					goto out_fini_handler;
> @@ -556,6 +559,8 @@ void do_restore(struct lxc_container *c, int pipe, char *directory, bool verbose
>  
>  out_fini_handler:
>  	lxc_fini(c->name, handler);
> +	if (unlink(pidfile) < 0 && errno != ENOENT)
> +		SYSERROR("unlinking pidfile failed");
>  
>  out:
>  	if (pipe >= 0) {
> -- 
> 2.1.4
> 
> _______________________________________________
> 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