[CRIU] [PATCH 1/2] service: Factor out err setting

Cyrill Gorcunov gorcunov at gmail.com
Fri Aug 26 03:55:07 PDT 2016


On Wed, Aug 24, 2016 at 09:11:45PM +0300, Pavel Emelyanov wrote:
> 
> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
> ---
>  criu/cr-service.c | 31 +++++++++++++++----------------
>  1 file changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/criu/cr-service.c b/criu/cr-service.c
> index fdd37d9..a2b4027 100644
> --- a/criu/cr-service.c
> +++ b/criu/cr-service.c
> @@ -110,6 +110,17 @@ err:
>  	return -1;
>  }
>  
> +static void set_resp_err(CriuResp *resp)
> +{
> +	int errn;
> +
> +	errn = get_cr_errno();
> +	if (errn) {
> +		resp->has_cr_errno = true;
> +		resp->cr_errno = errn;
> +	}
> +}

Why not simply

static void set_resp_err(CriuResp *resp)
{
	resp->cr_errno = get_cr_errno();
	resp->has_cr_errno = resp->cr_errno ? true : false;
}


More information about the CRIU mailing list