summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-09-23 16:03:41 +0200
committerThomas Haller <thaller@redhat.com>2015-09-23 16:09:43 +0200
commitd6370d09e6aa158d4fc7fe1e2ce4c335eed1e017 (patch)
tree2720eb6683637dfca36452650168aaf8f25f3982
parent94bbe7465f35b69487f306ed60b99ae6d50784e6 (diff)
downloadNetworkManager-d6370d09e6aa158d4fc7fe1e2ce4c335eed1e017.tar.gz
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.
-rw-r--r--src/nm-logging.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nm-logging.c b/src/nm-logging.c
index f79ba3c2e4..30c754d163 100644
--- a/src/nm-logging.c
+++ b/src/nm-logging.c
@@ -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);