diff --git a/src/nm-logging.c b/src/nm-logging.c index 50927f8caf..c242d90319 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -599,6 +599,7 @@ _nm_log_impl (const char *file, va_list args; char *msg; GTimeVal tv; + int errno_saved; if ((guint) level >= G_N_ELEMENTS (_nm_logging_enabled_state)) g_return_if_reached (); @@ -606,6 +607,8 @@ _nm_log_impl (const char *file, if (!(_nm_logging_enabled_state[level] & domain)) return; + errno_saved = errno; + /* Make sure that %m maps to the specified error */ if (error != 0) { if (error < 0) @@ -719,6 +722,8 @@ _nm_log_impl (const char *file, } g_free (msg); + + errno = errno_saved; } /*****************************************************************************/