mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 17:30:16 +01: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
1 changed files with 4 additions and 1 deletions
|
|
@ -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…
Add table
Reference in a new issue