From: Daniel Lezcano Date: Fri, 23 Jul 2010 13:10:38 +0000 (+0200) Subject: Fix bad returned value X-Git-Tag: lxc-0.7.2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e239ff31a5c442ac1d006e836bc622371842dfa0;p=thirdparty%2Flxc.git Fix bad returned value In case of error the message will be always truncated. We check the message was truncated with the total size received which means the kernel as more info to give. Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/nl.c b/src/lxc/nl.c index fdaf07e66..236cfcb27 100644 --- a/src/lxc/nl.c +++ b/src/lxc/nl.c @@ -155,7 +155,8 @@ again: if (!ret) return 0; - if (msg.msg_flags & MSG_TRUNC) + if (msg.msg_flags & MSG_TRUNC && + ret == answer->nlmsghdr.nlmsg_len) return -EMSGSIZE; return ret; @@ -182,9 +183,8 @@ extern int netlink_send(struct nl_handler *handler, struct nlmsg *nlmsg) nladdr.nl_groups = 0; ret = sendmsg(handler->fd, &msg, 0); - if (ret < 0) { + if (ret < 0) return -errno; - } return ret; } @@ -209,7 +209,7 @@ extern int netlink_transaction(struct nl_handler *handler, struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(answer); return err->error; } - + return 0; }