[gdm/wip/xserver-in-session: 7/9] manager: clean up some wonky error handling in OpenSession



commit 04df388292e41c687924dbeb6c0b57fe51ba541d
Author: Ray Strode <rstrode redhat com>
Date:   Fri Feb 13 13:31:41 2015 -0500

    manager: clean up some wonky error handling in OpenSession
    
    We're leaking errors without sending them back to the caller.

 daemon/gdm-manager.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index f4e6aae..76203ae 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -990,7 +990,6 @@ gdm_manager_handle_open_session (GdmDBusManager        *manager,
 {
         GdmManager       *self = GDM_MANAGER (manager);
         const char       *sender;
-        GError           *error = NULL;
         GDBusConnection  *connection;
         GdmDisplay       *display = NULL;
         GdmSession       *session;
@@ -1017,26 +1016,30 @@ gdm_manager_handle_open_session (GdmDBusManager        *manager,
         session = get_seed_session_for_display (display);
 
         if (gdm_session_is_running (session)) {
-                error = g_error_new (G_DBUS_ERROR,
-                                     G_DBUS_ERROR_ACCESS_DENIED,
-                                     _("Can only be called before user is logged in"));
-                return FALSE;
+                g_dbus_method_invocation_return_error_literal (invocation,
+                                                               G_DBUS_ERROR,
+                                                               G_DBUS_ERROR_ACCESS_DENIED,
+                                                               _("Can only be called before user is logged 
in"));
+                return TRUE;
         }
 
         allowed_user = gdm_session_get_allowed_user (session);
 
         if (uid != allowed_user) {
-                error = g_error_new (G_DBUS_ERROR,
-                                     G_DBUS_ERROR_ACCESS_DENIED,
-                                     _("Caller not GDM"));
-                return FALSE;
+                g_dbus_method_invocation_return_error_literal (invocation,
+                                                               G_DBUS_ERROR,
+                                                               G_DBUS_ERROR_ACCESS_DENIED,
+                                                               _("Caller not GDM"));
+                return TRUE;
         }
 
         address = gdm_session_get_server_address (session);
 
         if (address == NULL) {
-                g_dbus_method_invocation_return_gerror (invocation, error);
-                g_error_free (error);
+                g_dbus_method_invocation_return_error_literal (invocation,
+                                                               G_DBUS_ERROR,
+                                                               G_DBUS_ERROR_ACCESS_DENIED,
+                                                               _("Unable to open private communication 
channel"));
                 return TRUE;
         }
 


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