[CRIU] [PATCH 5/8] cr-service: set cr_errno to EINVAL if set_opts_from_req fails

Ruslan Kuprieiev kupruser at gmail.com
Tue Dec 2 01:47:44 PST 2014


On 12/02/2014 10:40 AM, Pavel Emelyanov wrote:
> On 12/02/2014 01:52 AM, Ruslan Kuprieiev wrote:
>> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
>> ---
>>   cr-service.c       | 3 +++
>>   include/cr-errno.h | 1 +
>>   2 files changed, 4 insertions(+)
>>
>> diff --git a/cr-service.c b/cr-service.c
>> index 71d478d..e1a0403 100644
>> --- a/cr-service.c
>> +++ b/cr-service.c
>> @@ -30,6 +30,8 @@
>>
>>   #include "setproctitle.h"
>>
>> +#include "cr-errno.h"
>> +
>>   unsigned int service_sk_ino = -1;
>>
>>   static int recv_criu_msg(int socket_fd, CriuReq **msg)
>> @@ -341,6 +343,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
>>   	return 0;
>>
>>   err:
>> +	cr_errno = EINVAL;
>>   	return -1;
>>   }
>>
>> diff --git a/include/cr-errno.h b/include/cr-errno.h
>> index f86bba8..a8f1428 100644
>> --- a/include/cr-errno.h
>> +++ b/include/cr-errno.h
>> @@ -5,6 +5,7 @@ extern int cr_errno;
>>    * List of symbolic error names:
>>    * ESRCH	- no process can be found corresponding to that specified by pid
>>    * EEXIST	- process with such pid already exists
>> + * EINVAL	- bad options
>
> EINVAL is too ... generic. For bad RPC request I'd use the EBADRQC one
>

How about using ENOTSUPP for ivalid requests in the next patch,
and EBADRQC here?


>>    */
>>
>>   #endif /* __CR_ERRNO_H__ */
>>
>



More information about the CRIU mailing list