From 51b3dd73329ddabfd4fd72c23fa220ee948a854f Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Thu, 2 Jan 2014 01:38:07 -0500 Subject: [PATCH] GDBusConnection: don't write to stdout When losing the D-Bus connection, we would write to stdout about it just before killing ourselves with SIGTERM. We're a library, so we should probably use stderr instead. https://bugzilla.gnome.org/show_bug.cgi?id=721324 --- gio/gdbusconnection.c | 10 +++++----- gio/tests/gdbus-exit-on-close.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index fef04a599..43f7c93ee 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -799,14 +799,14 @@ g_dbus_connection_real_closed (GDBusConnection *connection, { if (error != NULL) { - g_print ("%s: Remote peer vanished with error: %s (%s, %d). Exiting.\n", - G_STRFUNC, - error->message, - g_quark_to_string (error->domain), error->code); + g_printerr ("%s: Remote peer vanished with error: %s (%s, %d). Exiting.\n", + G_STRFUNC, + error->message, + g_quark_to_string (error->domain), error->code); } else { - g_print ("%s: Remote peer vanished. Exiting.\n", G_STRFUNC); + g_printerr ("%s: Remote peer vanished. Exiting.\n", G_STRFUNC); } raise (SIGTERM); } diff --git a/gio/tests/gdbus-exit-on-close.c b/gio/tests/gdbus-exit-on-close.c index befad74be..c43133169 100644 --- a/gio/tests/gdbus-exit-on-close.c +++ b/gio/tests/gdbus-exit-on-close.c @@ -191,12 +191,12 @@ test_exit_on_close (gconstpointer test_data) if (td->exit_on_close == EXPLICITLY_FALSE || td->who_closes == LOCAL) { - g_test_trap_assert_stdout_unmatched (VANISHED_PATTERN); + g_test_trap_assert_stderr_unmatched (VANISHED_PATTERN); g_test_trap_assert_passed (); } else { - g_test_trap_assert_stdout (VANISHED_PATTERN); + g_test_trap_assert_stderr (VANISHED_PATTERN); g_test_trap_assert_failed(); } }