devlink: Fix error reporting

The current code doesn't set errno in case of extended ack.

Fixes: 049c58539f ("devlink: mnlg: Add support for extended ack")
Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Arkadi Sharshevsky 2018-02-28 11:24:22 +02:00 committed by Stephen Hemminger
parent 728eb8d00b
commit f85adc61dd

View File

@ -71,15 +71,15 @@ static int mnlg_cb_error(const struct nlmsghdr *nlh, void *data)
{
const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh);
if (nl_dump_ext_ack(nlh, NULL))
return MNL_CB_STOP;
/* Netlink subsystems returns the errno value with different signess */
if (err->error < 0)
errno = -err->error;
else
errno = err->error;
if (nl_dump_ext_ack(nlh, NULL))
return MNL_CB_ERROR;
return err->error == 0 ? MNL_CB_STOP : MNL_CB_ERROR;
}