[gvfs/wip/oholy/sftp-test: 2/2] sftp: Improve debug output of ssh cmdline
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/oholy/sftp-test: 2/2] sftp: Improve debug output of ssh cmdline
- Date: Mon, 25 Feb 2019 09:45:06 +0000 (UTC)
commit bc602d1b6e91cbdd3ec7240148770d89495eef62
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]