summarylogtreecommitdiffstats
path: root/fix-systemd-support.patch
diff options
context:
space:
mode:
authorBalló György2021-04-27 21:03:38 +0000
committerBalló György2021-04-27 21:03:38 +0000
commit0a968287a15f9c00425ea66bb5b259a69d21607f (patch)
treea0d4a252f19d77bf66903e0e91be7df5191fd4b5 /fix-systemd-support.patch
downloadaur-gnome-screensaver.tar.gz
Move gnome-screensaver from [community]
Diffstat (limited to 'fix-systemd-support.patch')
-rw-r--r--fix-systemd-support.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/fix-systemd-support.patch b/fix-systemd-support.patch
new file mode 100644
index 000000000000..61db060291b8
--- /dev/null
+++ b/fix-systemd-support.patch
@@ -0,0 +1,91 @@
+From cac2c0ad8f4f40b6b175b9fbcde06935859f1bbc Mon Sep 17 00:00:00 2001
+From: Peter de Ridder <peter@xfce.org>
+Date: Wed, 20 Mar 2013 20:44:51 +0100
+Subject: [PATCH] Use the session path instead of the session id.
+
+---
+ src/gs-listener-dbus.c | 47 +++++++++++++++++++++++++++--------------------
+ 1 file changed, 27 insertions(+), 20 deletions(-)
+
+diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c
+index 703d9e1..11fb95e 100644
+--- a/src/gs-listener-dbus.c
++++ b/src/gs-listener-dbus.c
+@@ -25,6 +25,7 @@
+ #include <stdio.h>
+ #include <time.h>
+ #include <string.h>
++#include <unistd.h>
+
+ #include <glib/gi18n.h>
+
+@@ -116,19 +117,8 @@ enum {
+ if (listener->priv->session_id == NULL)
+ return FALSE;
+
+-#ifdef WITH_SYSTEMD
+- /* The bus object path is simply the actual session ID
+- * prefixed to make it a bus path */
+- if (listener->priv->have_systemd)
+- return g_str_has_prefix (ssid, SYSTEMD_LOGIND_SESSION_PATH "/")
+- && strcmp (ssid + sizeof (SYSTEMD_LOGIND_SESSION_PATH),
+- listener->priv->session_id) == 0;
+-#endif
+-
+-#ifdef WITH_CONSOLE_KIT
+ if (strcmp (ssid, listener->priv->session_id) == 0)
+ return TRUE;
+-#endif
+
+ return FALSE;
+ }
+@@ -416,20 +406,37 @@ enum {
+
+ #ifdef WITH_SYSTEMD
+ if (listener->priv->have_systemd) {
+- char *t;
+- int r;
++ dbus_uint32_t pid = getpid();
+
+- r = sd_pid_get_session (0, &t);
+- if (r < 0) {
+- gs_debug ("Couldn't determine our own session id: %s", strerror (-r));
++ message = dbus_message_new_method_call (SYSTEMD_LOGIND_SERVICE, SYSTEMD_LOGIND_PATH, SYSTEMD_LOGIND_INTERFACE, "GetSessionByPID");
++ if (message == NULL) {
++ gs_debug ("Couldn't allocate the dbus message");
+ return NULL;
+ }
+
+- /* t is allocated with malloc(), we need it with g_malloc() */
+- ssid = g_strdup(t);
+- free (t);
++ if (dbus_message_append_args (message, DBUS_TYPE_UINT32, &pid, DBUS_TYPE_INVALID) == FALSE) {
++ gs_debug ("Couldn't add args to the dbus message");
++ return NULL;
++ }
++
++ /* FIXME: use async? */
++ reply = dbus_connection_send_with_reply_and_block (listener->priv->system_connection,
++ message,
++ -1, &error);
++ dbus_message_unref (message);
++
++ if (dbus_error_is_set (&error)) {
++ gs_debug ("%s raised:\n %s\n\n", error.name, error.message);
++ dbus_error_free (&error);
++ return NULL;
++ }
++
++ dbus_message_iter_init (reply, &reply_iter);
++ dbus_message_iter_get_basic (&reply_iter, &ssid);
++
++ dbus_message_unref (reply);
+
+- return ssid;
++ return g_strdup (ssid);
+ }
+ #endif
+
+--
+1.8.4
+