diff options
author | Thomas Haller <thaller@redhat.com> | 2019-02-12 09:12:45 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-02-12 09:13:29 +0100 |
commit | 128099151d23818501e9d9600aec64fbfe999322 (patch) | |
tree | c0d87489646d6c1c5b85957928e2054c58d1710f | |
parent | 5d9a2d9168dbfc999fabebc09ddffce2503897a6 (diff) | |
download | NetworkManager-128099151d23818501e9d9600aec64fbfe999322.tar.gz |
shared: fix nm_errno_from_native() for negative input
Fixes: 67130e67060b2bf28ce68c7714ea021227ece751
-rw-r--r-- | shared/nm-utils/nm-errno.h | 2 | ||||
-rw-r--r-- | src/platform/nm-netlink.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/shared/nm-utils/nm-errno.h b/shared/nm-utils/nm-errno.h index 4b16b216ec..d77735a7a6 100644 --- a/shared/nm-utils/nm-errno.h +++ b/shared/nm-utils/nm-errno.h @@ -162,6 +162,8 @@ nm_errno_from_native (int errsv) case 0: return NME_ERRNO_SUCCESS; case G_MININT: return NME_ERRNO_OUT_OF_RANGE; default: + if (errsv < 0) + errsv = -errsv; return G_UNLIKELY ( errsv >= _NM_ERRNO_RESERVED_FIRST && errsv <= _NM_ERRNO_RESERVED_LAST) ? NME_NATIVE_ERRNO diff --git a/src/platform/nm-netlink.c b/src/platform/nm-netlink.c index ec41d2308c..3aac1998b6 100644 --- a/src/platform/nm-netlink.c +++ b/src/platform/nm-netlink.c @@ -1059,7 +1059,7 @@ do { \ nmerr = _cb->type##_cb ((msg), _cb->type##_arg); \ switch (nmerr) { \ case NL_OK: \ - nmerr = 0; \ + nm_assert (nmerr == 0); \ break; \ case NL_SKIP: \ goto skip; \ @@ -1204,6 +1204,7 @@ skip: /* Multipart message not yet complete, continue reading */ nm_clear_g_free (&buf); + nmerr = 0; goto continue_reading; } |