[gdm/wip/xserver-in-session: 1/54] manager: clean up some wonky error handling in OpenSession
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/wip/xserver-in-session: 1/54] manager: clean up some wonky error handling in OpenSession
- Date: Tue, 17 Feb 2015 06:05:59 +0000 (UTC)
commit e7038d1ad5c365415aa3bad3ee63fe4757bdce0a
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 684e462..a54931d 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -921,7 +921,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;
@@ -948,26 +947,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]