[network-manager-libreswan/th/vpn-plugin-debug-bgo766872: 19/22] service: log command line in do_spawn()



commit f3b50ecda666fccd9c95d5ee0ab43a1c898c5471
Author: Thomas Haller <thaller redhat com>
Date:   Fri May 27 19:15:27 2016 +0200

    service: log command line in do_spawn()

 src/nm-libreswan-service.c |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index 8999f8b..c1f6e50 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -622,7 +622,7 @@ do_spawn (NMLibreswanPlugin *self,
        GError *local = NULL;
        va_list ap;
        GPtrArray *argv;
-       gs_free char *cmdline = NULL;
+       char *cmdline = NULL;
        char *arg;
        gboolean success;
        GPid pid = 0;
@@ -636,26 +636,25 @@ do_spawn (NMLibreswanPlugin *self,
        va_end (ap);
        g_ptr_array_add (argv, NULL);
 
-       _LOGI ("Spawn: %s", (cmdline = g_strjoinv (" ", (char **) argv->pdata)));
+       _LOGD ("spawn: %s", (cmdline = g_strjoinv (" ", (char **) argv->pdata)));
+       g_clear_pointer (&cmdline, g_free);
+
+       success = g_spawn_async_with_pipes (NULL, (char **) argv->pdata, NULL,
+                                           G_SPAWN_DO_NOT_REAP_CHILD,
+                                           NULL, NULL, &pid, out_stdin,
+                                           out_stdout, out_stderr, &local);
 
-       if (out_stdin || out_stderr || out_stdout) {
-               success = g_spawn_async_with_pipes (NULL, (char **) argv->pdata, NULL,
-                                                   G_SPAWN_DO_NOT_REAP_CHILD,
-                                                   NULL, NULL, &pid, out_stdin,
-                                                   out_stdout, out_stderr, &local);
-       } else {
-               success = g_spawn_async (NULL, (char **) argv->pdata, NULL,
-                                        G_SPAWN_DO_NOT_REAP_CHILD,
-                                        NULL, NULL, &pid, &local);
-       }
        if (success) {
-               _LOGD ("Spawn: child process %d", pid);
+               _LOGI ("spawn: success: %ld (%s)",
+                      (long) pid,
+                      (cmdline = g_strjoinv (" ", (char **) argv->pdata)));
        } else {
-               _LOGW ("Spawn failed: (%s/%d) %s",
-                      g_quark_to_string (local->domain),
-                      local->code, local->message);
+               _LOGW ("spawn: failed: %s (%s)",
+                      local->message,
+                      (cmdline = g_strjoinv (" ", (char **) argv->pdata)));
                g_propagate_error (error, local);
        }
+       g_clear_pointer (&cmdline, g_free);
 
        if (out_pid)
                *out_pid = pid;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]