[X2Go-Commits] [libx2goclient] 07/44: src/x2goclient-network-ssh.c: add another helper function x2goclient_network_ssh_gptrarray_print_debug (), wrapping the GPtrArray printing to g_log () and its DEBUG target.
git-admin at x2go.org
git-admin at x2go.org
Fri Sep 18 01:55:37 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 ca8983d9615d4f97e7d99c5e059ed1d5ae6a6be7
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Jul 30 10:52:11 2020 +0200
src/x2goclient-network-ssh.c: add another helper function x2goclient_network_ssh_gptrarray_print_debug (), wrapping the GPtrArray printing to g_log () and its DEBUG target.
We'll probably use it later on again, so split this out.
---
src/x2goclient-network-ssh.c | 42 +++++++++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c
index f43a894..3bdedd2 100644
--- a/src/x2goclient-network-ssh.c
+++ b/src/x2goclient-network-ssh.c
@@ -135,6 +135,7 @@ static gboolean x2goclient_network_ssh_parent_connect (X2GoClientNetwork *parent
static gboolean x2goclient_network_ssh_fetch_openssh_version (X2GoClientNetworkSSH *self, GError **gerr);
static void x2goclient_network_ssh_log_std_str (const gchar * const str, const gsize str_size, const _Bool select_stderr);
static gboolean x2goclient_network_ssh_gptrarray_to_string (GPtrArray * const arr, const gchar * const prelude, gchar ** const ret_str);
+static void x2goclient_network_ssh_gptrarray_print_debug (GPtrArray * const arr, const gchar * const prelude, const gchar * const desc);
static void x2goclient_network_ssh_class_init (X2GoClientNetworkSSHClass *klass) {
@@ -951,21 +952,7 @@ static gboolean x2goclient_network_ssh_parent_connect (X2GoClientNetwork *parent
}
if (ret) {
- gchar *ssh_cmd_str = NULL;
- if (x2goclient_network_ssh_gptrarray_to_string (ssh_cmd, "Would try to connect via:", &ssh_cmd_str)) {
- if (ssh_cmd_str) {
- g_log (NULL, G_LOG_LEVEL_DEBUG, "%s", ssh_cmd_str);
-
- g_free (ssh_cmd_str);
- ssh_cmd_str = NULL;
- }
- else {
- g_log (NULL, G_LOG_LEVEL_DEBUG, "Unable to print out OpenSSH client command, it was completely empty.");
- }
- }
- else {
- g_log (NULL, G_LOG_LEVEL_DEBUG, "Unable to print out OpenSSH client command, internal error (the string likely was too big).");
- }
+ x2goclient_network_ssh_gptrarray_print_debug (ssh_cmd, "Would try to connect via:", "OpenSSH client command");
g_log (NULL, G_LOG_LEVEL_DEBUG, "Launching!");
GError *ssh_err = NULL;
@@ -1256,3 +1243,28 @@ static gboolean x2goclient_network_ssh_gptrarray_to_string (GPtrArray * const ar
#undef HANDLE_TRUNC
#undef SIZE_LOW_WRAP
}
+
+static void x2goclient_network_ssh_gptrarray_print_debug (GPtrArray * const arr, const gchar * const prelude, const gchar * const desc) {
+ gchar *arr_str = NULL;
+ const gchar *def_desc = "unspecified pointer array";
+ const gchar *real_desc = def_desc;
+
+ if (desc) {
+ real_desc = desc;
+ }
+
+ if (x2goclient_network_ssh_gptrarray_to_string (arr, prelude, &arr_str)) {
+ if (arr_str) {
+ g_log (NULL, G_LOG_LEVEL_DEBUG, "%s", arr_str);
+
+ g_free (arr_str);
+ arr_str = NULL;
+ }
+ else {
+ g_log (NULL, G_LOG_LEVEL_DEBUG, "Unable to print out %s, it was completely empty.", real_desc);
+ }
+ }
+ else {
+ g_log (NULL, G_LOG_LEVEL_DEBUG, "Unable to print out %s, internal error (the string likely was too big).", real_desc);
+ }
+}
--
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