callouts: always print the environment even if no scripts are present
authorThomas Haller <thaller@redhat.com>
Tue, 19 Jan 2016 10:01:33 +0000 (11:01 +0100)
committerThomas Haller <thaller@redhat.com>
Tue, 19 Jan 2016 10:01:33 +0000 (11:01 +0100)
Commit ac6522bbf109ac0af8845cc81903155bab914760 moved logging of the environment
after the check for @error_message to avoid a crash. However, in case of no
scripts (request->scripts->len == 0) we still want to log the environment,
so move it back to where it was, but avoid the crash.

callouts/nm-dispatcher.c

index eedc20d..a635e21 100644 (file)
@@ -718,6 +718,11 @@ handle_action (NMDBusDispatcher *dbus_dispatcher,
        g_slist_free (sorted_scripts);
 
        _LOG_R_I (request, "new request (%u scripts)", request->scripts->len);
+       if (   _LOG_R_D_enabled (request)
+           && request->envp) {
+               for (p = request->envp; *p; p++)
+                       _LOG_R_D (request, "environment: %s", *p);
+       }
 
        if (error_message || request->scripts->len == 0) {
                GVariant *results;
@@ -734,11 +739,6 @@ handle_action (NMDBusDispatcher *dbus_dispatcher,
                return TRUE;
        }
 
-       if (_LOG_R_D_enabled (request)) {
-               for (p = request->envp; *p; p++)
-                       _LOG_R_D (request, "environment: %s", *p);
-       }
-
        nm_clear_g_source (&quit_id);
 
        h->num_requests_pending++;