[CRIU] [PATCH 1/5] netlink: Don't signify error code

Pavel Emelyanov xemul at parallels.com
Tue Mar 26 11:40:59 EDT 2013


On 03/26/2013 07:25 PM, Cyrill Gorcunov wrote:
> On Tue, Mar 26, 2013 at 07:19:19PM +0400, Pavel Emelyanov wrote:
>> On 03/26/2013 01:26 AM, Cyrill Gorcunov wrote:
>>> netlink layer reports negative error code
>>> so no need to signify it.
>>>
>>> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
>>> ---
>>>  libnetlink.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/libnetlink.c b/libnetlink.c
>>> index e852aaa..4e4e02b 100644
>>> --- a/libnetlink.c
>>> +++ b/libnetlink.c
>>> @@ -50,7 +50,7 @@ static int nlmsg_receive(char *buf, int len, int (*cb)(struct nlmsghdr *, void *
>>>  			if (err->error == 0)
>>>  				return 0;
>>>  
>>> -			pr_err("ERROR %d reported by netlink\n", -err->error);
>>> +			pr_err("ERROR %d reported by netlink\n", err->error);
>>
>> It's signified to get positive error code in message.
> 
> Which is confusing since as I mentioned for other cases we report
> negative error code, but in this line we do signify it for some reason :/
> 
> 		if (hdr->nlmsg_type == NLMSG_DONE) {
> 			int *len = (int *)NLMSG_DATA(hdr);
> 
> 			if (*len < 0) {
> 				pr_err("ERROR %d reported by netlink (%s)\n",
> 					*len, strerror(-*len));
> 				return -1;
> 			}
> 
> 			return 0;
> 		}
> 
> so i think we better don't signify it here as well.
> .
> 


OK, fair enough. Applied.


More information about the CRIU mailing list