]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Fix bad returned value
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 23 Jul 2010 13:10:38 +0000 (15:10 +0200)
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 <dlezcano@fr.ibm.com>
src/lxc/nl.c

index fdaf07e66597800799521db389891b0e20bdb79d..236cfcb27f64e46aef480a35a6644767f71e97ba 100644 (file)
@@ -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;
 }