[gnome-session] systemd: add better error handling



commit 079398edaa989b3356e253d23103965784bf51a6
Author: Ray Strode <rstrode redhat com>
Date:   Mon Jan 30 15:28:43 2012 -0500

    systemd: add better error handling
    
    My booted version of systemd didn't
    support sd_session_get_service() which
    lead to crashes.
    
    This commit makes it probably recover in
    that case.
    
    Related to bug 666891

 gnome-session/gsm-systemd.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gnome-session/gsm-systemd.c b/gnome-session/gsm-systemd.c
index d87c5a6..7704271 100644
--- a/gnome-session/gsm-systemd.c
+++ b/gnome-session/gsm-systemd.c
@@ -357,12 +357,17 @@ static gboolean
 gsm_systemd_is_login_session (GsmSystem *system)
 {
         GsmSystemd *manager = GSM_SYSTEMD (system);
+        int res;
         gboolean ret;
-        gchar *service;
+        gchar *service = NULL;
 
         ret = FALSE;
 
-        sd_session_get_service (manager->priv->session_id, &service);
+        res = sd_session_get_service (manager->priv->session_id, &service);
+        if (res < 0) {
+                g_warning ("could not get pam service: %s", strerror (-ret));
+                return FALSE;
+        }
         ret = (g_strcmp0 (service, "gdm-welcome") == 0);
         free (service);
 



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