Quoting Tycho Andersen (tycho.ander...@canonical.com):
> From: Tycho Andersen <tycho.ander...@canonical.com>
> 
> Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
> ---
>  src/lxc/lxc_checkpoint.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/src/lxc/lxc_checkpoint.c b/src/lxc/lxc_checkpoint.c
> index cfa08fc..8345789 100644
> --- a/src/lxc/lxc_checkpoint.c
> +++ b/src/lxc/lxc_checkpoint.c
> @@ -20,6 +20,8 @@
>  #include <stdio.h>
>  #include <errno.h>
>  #include <unistd.h>
> +#include <sys/types.h>
> +#include <sys/wait.h>
>  
>  #include <lxc/lxccontainer.h>
>  
> @@ -168,6 +170,24 @@ bool restore(struct lxc_container *c)
>  
>       lxc_container_put(c);
>  
> +     if (pid != 0) {
> +             int status;
> +             pid_t w;

hi,

what about using wait_for_pid(pid) here?

(It's in src/lxc/utils.c)

> +             w = waitpid(pid, &status, 0);
> +             if (w == -1) {
> +                     perror("waitpid");
> +                     return false;
> +             }
> +
> +             if (WIFEXITED(status)) {
> +                     return status == 0;
> +             } else {
> +                     fprintf(stderr, "restore process was killed with signal 
> %d\n", WTERMSIG(status));
> +                     return false;
> +             }
> +     }
> +
>       return ret;
>  }
>  
> -- 
> 2.1.0
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to