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

Pavel Emelyanov xemul at virtuozzo.com
Mon Aug 29 06:07:57 PDT 2016


On 08/26/2016 01:55 PM, Cyrill Gorcunov wrote:
> 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;
> }

Yup, pretty possible. Will do.

-- Pavel



More information about the CRIU mailing list