[CRIU] Re: [PATCH 2/2] restore: Don't close pstree_fd several times

Pavel Emelyanov xemul at parallels.com
Tue Mar 6 09:10:25 EST 2012


> @@ -1457,19 +1457,17 @@ static int restore_all_tasks(pid_t pid, struct cr_options *opts)
>  {
>  	int pstree_fd = -1;
>  	u32 type = 0;
> -	int ret = -1;
>  
>  	pstree_fd = open_image_ro(CR_FD_PSTREE, pstree_pid);
>  	if (pstree_fd < 0)
>  		return -1;
>  
> -	if (prepare_shared(pstree_fd))
> -		goto out;
> +	if (prepare_shared(pstree_fd)) {
> +		close_safe(&pstree_fd);
> +		return -1;
> +	}
>  
> -	ret = restore_root_task(pstree_fd, opts);
> -out:
> -	close_safe(&pstree_fd);
> -	return ret;
> +	return restore_root_task(&pstree_fd, opts);

It doesn't have to be a pointer then.

>  }
>  
>  static long restorer_get_vma_hint(pid_t pid, struct list_head *self_vma_list, long vma_len)



More information about the CRIU mailing list