logging: coerce negative error values to positive errno

Especially systemd, which makes use of the error argument for logging, likes
to represent errors as negative numbers. We hence must invert a negative error
code to get the real errno.
This commit is contained in:
Thomas Haller 2015-09-23 16:03:41 +02:00
parent 94bbe7465f
commit d6370d09e6

View file

@ -431,8 +431,11 @@ _nm_log_impl (const char *file,
return;
/* Make sure that %m maps to the specified error */
if (error != 0)
if (error != 0) {
if (error < 0)
error = -error;
errno = error;
}
va_start (args, fmt);
msg = g_strdup_vprintf (fmt, args);