shared: fix nm_errno_from_native() for negative input

Fixes: 67130e6706
This commit is contained in:
Thomas Haller 2019-02-12 09:12:45 +01:00
parent 5d9a2d9168
commit 128099151d
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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;
}