[glib-networking] Fix crashes in log statements
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking] Fix crashes in log statements
- Date: Fri, 27 Mar 2020 20:57:02 +0000 (UTC)
commit 94456969ec34dea4a865e20ea7e80de6318d2a6c
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Fri Mar 27 15:53:06 2020 -0500
Fix crashes in log statements
We might not have an error in claim_op() if the application is ignoring
errors.
(There will always be an error in handshake_thread(), though, so no need
to check if it's NULL in this case.)
Fixes #131
tls/base/gtlsconnection-base.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index d6c4e37..0e3240e 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -549,7 +549,7 @@ claim_op (GTlsConnectionBase *tls,
if (error)
*error = g_error_copy (priv->handshake_error);
g_mutex_unlock (&priv->op_mutex);
- g_tls_log_debug (tls, "claim_op failed: %s", error ? (*error)->message : "no error");
+ g_tls_log_debug (tls, "claim_op failed: %s", priv->handshake_error->message);
return FALSE;
}
@@ -611,7 +611,7 @@ claim_op (GTlsConnectionBase *tls,
*/
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Cannot perform blocking operation during
TLS handshake"));
g_mutex_unlock (&priv->op_mutex);
- g_tls_log_debug (tls, "claim_op failed: %s", (*error)->message);
+ g_tls_log_debug (tls, "claim_op failed: cannot perform blocking operation during TLS handshake");
return FALSE;
}
@@ -633,7 +633,7 @@ claim_op (GTlsConnectionBase *tls,
/* Intentionally not translated because this is not a fatal error to be
* presented to the user, and to avoid this showing up in profiling. */
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, "Operation would block");
- g_tls_log_debug (tls, "claim_op failed: %s", (*error)->message);
+ g_tls_log_debug (tls, "claim_op failed: operation would block");
return FALSE;
}
@@ -675,7 +675,7 @@ claim_op (GTlsConnectionBase *tls,
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
_("Socket I/O timed out"));
- g_tls_log_debug (tls, "claim_op failed: %s", (*error)->message);
+ g_tls_log_debug (tls, "claim_op failed: socket I/O timed out");
return FALSE;
}
@@ -1466,7 +1466,7 @@ handshake_thread (GTask *task,
if (status != G_TLS_CONNECTION_BASE_OK)
{
g_task_return_error (task, error);
- g_tls_log_debug (tls, "TLS handshake thread failed: %s", error ? error->message : "no error");
+ g_tls_log_debug (tls, "TLS handshake thread failed: %s", error->message);
return;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]