[network-manager-openvpn: 2/6] helper: log the command line arguments for "--helper-debug"



commit 38c4273ad269cca254e4e7687917d34bf050e04b
Author: Thomas Haller <thaller redhat com>
Date:   Tue Mar 18 15:39:56 2014 +0100

    helper: log the command line arguments for "--helper-debug"
    
    Signed-off-by: Thomas Haller <thaller redhat com>

 src/nm-openvpn-service-openvpn-helper.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/nm-openvpn-service-openvpn-helper.c b/src/nm-openvpn-service-openvpn-helper.c
index 3b752b3..1094d80 100644
--- a/src/nm-openvpn-service-openvpn-helper.c
+++ b/src/nm-openvpn-service-openvpn-helper.c
@@ -556,10 +556,25 @@ main (int argc, char *argv[])
        shift = i - 1;
 
        if (helper_debug) {
+               GString *args;
+
+               args = g_string_new (NULL);
+               for (i = 0; i < argc; i++) {
+                       if (i > 0)
+                               g_string_append_c (args, ' ');
+                       if (shift && 1 + shift == i)
+                               g_string_append (args, "  ");
+                       tmp = g_strescape (argv[i], NULL);
+                       g_string_append_printf (args, "\"%s\"", tmp);
+                       g_free (tmp);
+               }
+
+               g_message ("command line: %s", args->str);
+               g_string_free (args, TRUE);
                g_message ("openvpn script environment ---------------------------");
                iter = environ;
                while (iter && *iter)
-                       g_print ("%s\n", *iter++);
+                       g_message ("%s", *iter++);
                g_message ("------------------------------------------------------");
        }
 


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