[glib] GDBusConnection: don't write to stdout



commit 51b3dd73329ddabfd4fd72c23fa220ee948a854f
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Jan 2 01:38:07 2014 -0500

    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 fef04a5..43f7c93 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 befad74..c431331 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();
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]