3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-25 08:02:38 +01:00

monitor: Fix printing of netlink error codes

This commit is contained in:
Marcel Holtmann 2014-08-09 19:22:19 -07:00
parent 7689d2202f
commit 8c5de4fd1f

View File

@ -928,10 +928,10 @@ static void print_message(const struct nlmsghdr *nlmsg)
NLMSG_PAYLOAD(nlmsg, 0)); NLMSG_PAYLOAD(nlmsg, 0));
if (nlmsg->nlmsg_type == NLMSG_ERROR) { if (nlmsg->nlmsg_type == NLMSG_ERROR) {
uint32_t status = *((uint32_t *) NLMSG_DATA(nlmsg)); struct nlmsgerr *err = NLMSG_DATA(nlmsg);
printf("%*cStatus: %s (%u)\n", 4, ' ', printf("%*cStatus: %s (%d)\n", 4, ' ',
strerror(status), status); strerror(-err->error), -err->error);
print_hexdump(NLMSG_DATA(nlmsg) + 4, print_hexdump(NLMSG_DATA(nlmsg) + 4,
NLMSG_PAYLOAD(nlmsg, 4)); NLMSG_PAYLOAD(nlmsg, 4));
} else } else