[X2Go-Commits] [libx2goclient] 04/04: src/x2goclient-network-ssh.c: stop using g_printf (), use g_log () instead.
git-admin at x2go.org
git-admin at x2go.org
Mon Jun 29 15:31:28 CEST 2020
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository libx2goclient.
commit afb65da70f7f7adcd06fbfbbe21d7882f7bf4230
Author: Mihai Moldovan <ionic at ionic.de>
Date: Mon Jun 29 14:49:07 2020 +0200
src/x2goclient-network-ssh.c: stop using g_printf (), use g_log () instead.
---
src/x2goclient-network-ssh.c | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c
index e873c7e..010810d 100644
--- a/src/x2goclient-network-ssh.c
+++ b/src/x2goclient-network-ssh.c
@@ -945,13 +945,34 @@ static gboolean x2goclient_network_ssh_parent_connect (X2GoClientNetwork *parent
}
if (ret) {
- g_printf ("Would try to connect via:");
- for (gsize i = 0; i < ssh_cmd->len; ++i) {
- g_printf (" [%s]", (gchar *)g_ptr_array_index (ssh_cmd, i));
+ {
+ /*
+ * Yeah, this is potentially slow, but there is no better way to use
+ * g_log ().
+ */
+ const gchar *tmp_start = "Would try to connect via:";
+ gchar *tmp = NULL;
+ for (gsize i = 0; i < ssh_cmd->len; ++i) {
+ gchar *tmp_new = NULL;
+
+ if (0 == i) {
+ tmp_new = g_strdup_printf ("%s [%s]", tmp_start, (gchar *)g_ptr_array_index (ssh_cmd, i));
+ }
+ else {
+ tmp_new = g_strdup_printf ("%s [%s]", tmp, (gchar *)g_ptr_array_index (ssh_cmd, i));
+
+ g_free (tmp);
+ }
+
+ tmp = tmp_new;
+ }
+ g_log (NULL, G_LOG_LEVEL_DEBUG, "%s", tmp);
+
+ g_free (tmp);
+ tmp = NULL;
}
- g_printf ("\n");
- g_printf ("Launching!\n");
+ g_log (NULL, G_LOG_LEVEL_DEBUG, "Launching!");
GError *ssh_err = NULL;
GSubprocessFlags flags = G_SUBPROCESS_FLAGS_STDOUT_PIPE;
@@ -967,10 +988,10 @@ static gboolean x2goclient_network_ssh_parent_connect (X2GoClientNetwork *parent
ret = (self->master_conn != NULL);
if (ret) {
- g_printf ("Process started/executed successfully!\n");
+ g_log (NULL, G_LOG_LEVEL_DEBUG, "Process started/executed successfully!");
if (ssh_err) {
- g_printf ("Successful execution, but ssh_err set? Weird, here's the message: %s", ssh_err->message);
+ g_log (NULL, G_LOG_LEVEL_WARNING, "Successful execution, but ssh_err set? Weird, here's the message: %s", ssh_err->message);
}
GCancellable *master_conn_comm_cancel = g_cancellable_new ();
@@ -1007,7 +1028,7 @@ static gboolean x2goclient_network_ssh_parent_connect (X2GoClientNetwork *parent
g_clear_error (&ssh_err);
}
else {
- g_printf ("Process didn't execute/start successfully!\nError:\n>>>%s<<<\n", ssh_err->message);
+ g_log (NULL, G_LOG_LEVEL_CRITICAL, "Process didn't execute/start successfully!\nError:\n>>>%s<<<", ssh_err->message);
}
g_clear_error (&ssh_err);
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
More information about the x2go-commits
mailing list