mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-20 00:21:29 +00:00
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:
parent
94bbe7465f
commit
d6370d09e6
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue