[upower] Fix crash when D-Bus isn't available
Bastien Nocera
hadess at fedoraproject.org
Fri Nov 8 15:31:53 UTC 2013
commit 4c187d769f5d34302fa7ce5ea18d600083e0ad60
Author: Bastien Nocera <hadess at hadess.net>
Date: Fri Nov 8 16:32:08 2013 +0100
Fix crash when D-Bus isn't available
...fault-on-getting-property-when-daemon-is-.patch | 29 ++++++++++++++++++++
upower.spec | 8 +++++-
2 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/0001-lib-Fix-segfault-on-getting-property-when-daemon-is-.patch b/0001-lib-Fix-segfault-on-getting-property-when-daemon-is-.patch
new file mode 100644
index 0000000..5f4eea2
--- /dev/null
+++ b/0001-lib-Fix-segfault-on-getting-property-when-daemon-is-.patch
@@ -0,0 +1,29 @@
+From 0d64bbddaa0078ef148d609a3cfad854cf00d7de Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martinpitt at gnome.org>
+Date: Fri, 8 Nov 2013 14:59:50 +0100
+Subject: [PATCH] lib: Fix segfault on getting property when daemon is not
+ running
+
+This fixes "upower --version" when the daemon is not running, and thus the
+client proxy is NULL.
+---
+ libupower-glib/up-client.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c
+index 35d7b5d..17fb02d 100644
+--- a/libupower-glib/up-client.c
++++ b/libupower-glib/up-client.c
+@@ -322,6 +322,9 @@ up_client_get_property (GObject *object,
+ UpClient *client;
+ client = UP_CLIENT (object);
+
++ if (client->priv->proxy == NULL)
++ return;
++
+ switch (prop_id) {
+ case PROP_DAEMON_VERSION:
+ g_value_set_string (value, up_client_glue_get_daemon_version (client->priv->proxy));
+--
+1.8.4.2
+
diff --git a/upower.spec b/upower.spec
index f5321c6..5abb996 100644
--- a/upower.spec
+++ b/upower.spec
@@ -1,7 +1,7 @@
Summary: Power Management Service
Name: upower
Version: 0.99.0
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv2+
Group: System Environment/Libraries
URL: http://upower.freedesktop.org/
@@ -25,6 +25,8 @@ Requires: polkit >= 0.92
Requires: udev
Requires: gobject-introspection
+Patch0: 0001-lib-Fix-segfault-on-getting-property-when-daemon-is-.patch
+
%description
UPower (formerly DeviceKit-power) provides a daemon, API and command
line tools for managing power devices attached to the system.
@@ -40,6 +42,7 @@ Headers and libraries for UPower.
%prep
%setup -q
+%patch0 -p1
%build
%configure \
@@ -97,6 +100,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
%{_includedir}/libupower-glib/upower.h
%changelog
+* Fri Nov 08 2013 Bastien Nocera <bnocera at redhat.com> 0.99.0-2
+- Fix crash when D-Bus isn't available
+
* Tue Oct 29 2013 Richard Hughes <rhughes at redhat.com> - 0.99.0-1
- New upstream release
- This version contains major API changes and bumps library soname.
More information about the scm-commits
mailing list