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

Tycho Andersen tycho.andersen at canonical.com
Thu Aug 7 06:35:52 PDT 2014


On Thu, Aug 07, 2014 at 10:21:59AM +0400, Pavel Emelyanov wrote:
> 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.

Yes it does; I mostly sent this because of the next patch in the
series, but it works just fine the way it was.

Tycho

> > ---
> >  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