[CRIU] [PATCH 1/2] restore: actually fail if clone() fails

Pavel Emelyanov xemul at parallels.com
Wed Aug 6 23:21:59 PDT 2014


On 08/06/2014 10:06 PM, Tycho Andersen wrote:
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>

Applied, thanks :)

Doesn't the code below this "if" propagates negative ret value
to the exit? Anyway, the explicit goto is better, just curious.

> ---
>  cr-restore.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/cr-restore.c b/cr-restore.c
> index 7569afa..88c4b95 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -982,8 +982,11 @@ static inline int fork_with_pid(struct pstree_item *item)
>  	ret = clone(restore_task_with_children, ca.stack_ptr,
>  			ca.clone_flags | SIGCHLD, &ca);
>  
> -	if (ret < 0)
> +	if (ret < 0) {
>  		pr_perror("Can't fork for %d", pid);
> +		goto err_unlock;
> +	}
> +
>  
>  	if (item == root_item)
>  		item->pid.real = ret;
> 



More information about the CRIU mailing list