[gvfs] sftp: Improve debug output of ssh cmdline



commit 80c4f953e361bd5157d494181a5688278e8408be
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Feb 25 10:14:56 2019 +0100

    sftp: Improve debug output of ssh cmdline
    
    Currently, the debug output of ssh cmdline looks like:
    sftp: spawn_ssh: sftp: /usr/bin/ssh sftp: -oForwardX11 no sftp: -oForwardAgent
     no sftp: -oPermitLocalCommand no sftp: -oClearAllForwardings yes sftp: -oProtocol 2
     sftp: -oNoHostAuthenticationForLocalhost yes sftp: -p sftp: 22222 sftp: -s sftp: 10.220.47.158
     sftp: sftp sftp:
    
    This is because we add prefixes for each g_debug, which makes this unreadable.
    Let's concatenate the strings before printing over g_debug.

 daemon/gvfsbackendsftp.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index 3c3f5738..2314579f 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -538,11 +538,17 @@ spawn_ssh (GVfsBackend *backend,
   if (gvfs_get_debug ())
     {
       const char **arg;
+      GString *cmd;
 
-      g_debug ("spawn_ssh: ");
+      cmd = g_string_new (NULL);
       for (arg = (const char **)args; *arg != NULL; arg++)
-        g_debug ("%s ", *arg);
-      g_debug ("\n");
+        {
+          g_string_append (cmd, *arg);
+          g_string_append (cmd, " ");
+        }
+
+      g_debug ("spawn_ssh: %s\n", cmd->str);
+      g_string_free (cmd, TRUE);
     }
 
 #ifdef USE_PTY


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