diff options
author | Thomas Haller <thaller@redhat.com> | 2015-09-23 16:03:41 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-09-24 10:55:37 +0200 |
commit | 972865bc4ef67557f04fba6b7a92edb70c9d3927 (patch) | |
tree | 4d6d52acb1b2992f37aba33fc056d14c8b069267 | |
parent | e6160d3bc4212428bce240321f14f4f6b79534f6 (diff) | |
download | NetworkManager-972865bc4ef67557f04fba6b7a92edb70c9d3927.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.
(cherry picked from commit d6370d09e6aa158d4fc7fe1e2ce4c335eed1e017)
-rw-r--r-- | src/nm-logging.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nm-logging.c b/src/nm-logging.c index fa770344ed..b8433a25dd 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -381,8 +381,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); |