[gnome-session/gnome-3-8] systemd: Check errors on all D-Bus calls
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session/gnome-3-8] systemd: Check errors on all D-Bus calls
- Date: Tue, 30 Jul 2013 18:23:08 +0000 (UTC)
commit 5a4e38e5d16d8234d572d110d65a1b14a67c2e2e
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jul 30 14:15:32 2013 -0400
systemd: Check errors on all D-Bus calls
A somewhat common crash in F19 happens when one of these calls
fails, and we end up freeing a wild pointer. See
https://bugzilla.redhat.com/show_bug.cgi?id=977575
https://bugzilla.gnome.org/show_bug.cgi?id=705163
gnome-session/gsm-systemd.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gnome-session/gsm-systemd.c b/gnome-session/gsm-systemd.c
index ae29800..c00b1d0 100644
--- a/gnome-session/gsm-systemd.c
+++ b/gnome-session/gsm-systemd.c
@@ -321,6 +321,12 @@ gsm_systemd_init (GsmSystemd *manager)
G_MAXINT,
NULL,
NULL);
+ if (res == NULL) {
+ g_warning ("Could not get session id for session. Check that logind is "
+ "properly installed and pam_systemd is getting used at login.");
+ return;
+ }
+
g_variant_get (res, "(o)", &manager->priv->session_path);
g_variant_unref (res);
@@ -501,6 +507,12 @@ gsm_systemd_can_restart (GsmSystem *system)
G_MAXINT,
NULL,
NULL);
+ if (!res) {
+ g_warning ("Calling CanReboot failed. Check that logind is "
+ "properly installed and pam_systemd is getting used at login.");
+ return FALSE;
+ }
+
g_variant_get (res, "(s)", &rv);
g_variant_unref (res);
@@ -527,6 +539,12 @@ gsm_systemd_can_stop (GsmSystem *system)
G_MAXINT,
NULL,
NULL);
+ if (!res) {
+ g_warning ("Calling CanPowerOff failed. Check that logind is "
+ "properly installed and pam_systemd is getting used at login.");
+ return FALSE;
+ }
+
g_variant_get (res, "(s)", &rv);
g_variant_unref (res);
@@ -578,6 +596,12 @@ gsm_systemd_can_suspend (GsmSystem *system)
G_MAXINT,
NULL,
NULL);
+ if (!res) {
+ g_warning ("Calling CanSuspend failed. Check that logind is "
+ "properly installed and pam_systemd is getting used at login.");
+ return FALSE;
+ }
+
g_variant_get (res, "(s)", &rv);
g_variant_unref (res);
@@ -604,6 +628,12 @@ gsm_systemd_can_hibernate (GsmSystem *system)
G_MAXINT,
NULL,
NULL);
+ if (!res) {
+ g_warning ("Calling CanHibernate failed. Check that logind is "
+ "properly installed and pam_systemd is getting used at login.");
+ return FALSE;
+ }
+
g_variant_get (res, "(s)", &rv);
g_variant_unref (res);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]