Commit 279ad900 authored by Thomas Haller's avatar Thomas Haller

shared: fix nm_errno_from_native() for negative values

We first need to map negative values to their positive form,
and then do the check for the reserved range.

Fixes: 18732c34
parent a23989a3
......@@ -118,9 +118,9 @@ nm_errno_from_native (int errsv)
* are coerced to the special value NME_NATIVE_ERRNO, as they cannot
* otherwise be represented in nm-error number domain. */
if (errsv < 0) {
return G_UNLIKELY (errsv == G_MININT)
? NME_NATIVE_ERRNO
: -errsv;
if (G_UNLIKELY (errsv == G_MININT))
return NME_NATIVE_ERRNO;
errsv = -errsv;
}
return G_UNLIKELY ( errsv >= _NM_ERRNO_RESERVED_FIRST
&& errsv <= _NM_ERRNO_RESERVED_LAST)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment