[CRIU] [PATCH] ns: Use waitpid() in create_user_ns_hierarhy_fn()

Andrei Vagin avagin at virtuozzo.com
Wed Apr 5 11:12:17 PDT 2017


Applied

On Wed, Apr 05, 2017 at 12:43:34PM +0300, Kirill Tkhai wrote:
> We're interested in just created child only. Other possibly guys
> will be handled in appropriate places later (criu task may have
> helpers-children).
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  criu/namespaces.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/criu/namespaces.c b/criu/namespaces.c
> index 031507d5a..3847bc40e 100644
> --- a/criu/namespaces.c
> +++ b/criu/namespaces.c
> @@ -2354,16 +2354,15 @@ static int create_user_ns_hierarhy_fn(void *in_arg)
>  			goto out;
>  		}
>  		futex_wait_while_lt(futex, NS__CREATED);
> -		/* Get child real pid */
> -		pid = arg->pid;
> -		if (prepare_userns(pid, child->user.e) < 0) {
> +		/* Use child real pid */
> +		if (prepare_userns(arg->pid, child->user.e) < 0) {
>  			pr_err("Can't prepare child user_ns\n");
>  			goto out;
>  		}
>  		futex_set_and_wake(futex, NS__MAPS_POPULATED);
>  
>  		errno = 0;
> -		if (wait(&status) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) {
> +		if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) {
>  			pr_perror("Child process waiting: %d", status);
>  			close_pid_proc();
>  			goto out;
> 


More information about the CRIU mailing list