diff options
author | Thomas Haller <thaller@redhat.com> | 2015-09-23 16:03:41 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-09-23 16:09:43 +0200 |
commit | d6370d09e6aa158d4fc7fe1e2ce4c335eed1e017 (patch) | |
tree | 2720eb6683637dfca36452650168aaf8f25f3982 /src/nm-logging.c | |
parent | 94bbe7465f35b69487f306ed60b99ae6d50784e6 (diff) | |
download | NetworkManager-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.
Diffstat (limited to 'src/nm-logging.c')
-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 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); |