[network-manager-libreswan/th/vpn-plugin-debug-bgo766872: 18/20] service: log command line in do_spawn()
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-libreswan/th/vpn-plugin-debug-bgo766872: 18/20] service: log command line in do_spawn()
- Date: Tue, 14 Jun 2016 13:12:36 +0000 (UTC)
commit 5f419e3eb2ad8f822343b72955539b4c4f65868a
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 | 40 ++++++++++++++++------------------------
1 files changed, 16 insertions(+), 24 deletions(-)
---
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index 6dcf90a..a139df5 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -608,14 +608,7 @@ child_watch_cb (GPid pid, gint status, gpointer user_data)
g_clear_error (&error);
}
-static gboolean do_spawn (NMLibreswanPlugin *self,
- GPid *out_pid,
- int *out_stdin,
- int *out_stderr,
- GError **error,
- const char *progname,
- ...) G_GNUC_NULL_TERMINATED;
-
+G_GNUC_NULL_TERMINATED
static gboolean
do_spawn (NMLibreswanPlugin *self,
GPid *out_pid,
@@ -628,7 +621,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;
@@ -642,26 +635,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,
+ NULL, out_stderr, &local);
- if (out_stdin || out_stderr) {
- success = g_spawn_async_with_pipes (NULL, (char **) argv->pdata, NULL,
- G_SPAWN_DO_NOT_REAP_CHILD,
- NULL, NULL, &pid, out_stdin,
- NULL, 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]