- Ensure we've initialized errors when calling into PolicyKit.

- Resolves: #622830
This commit is contained in:
Richard Hughes 2010-08-10 16:01:59 +01:00
parent b4b365d344
commit 8bbd1fe476
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,44 @@
commit a4e099c5bff9f9fdb9067a0a6bb206d4c34745ae
Author: Richard Hughes <richard@hughsie.com>
Date: Tue Aug 10 15:52:12 2010 +0100
Ensure we've initialized errors when calling into PolicyKit
diff --git a/src/up-polkit.c b/src/up-polkit.c
index d7760dd..9b86394 100644
--- a/src/up-polkit.c
+++ b/src/up-polkit.c
@@ -69,11 +69,14 @@ up_polkit_check_auth (UpPolkit *polkit, PolkitSubject *subject, const gchar *act
{
gboolean ret = FALSE;
GError *error;
- GError *error_local;
+ GError *error_local = NULL;
PolkitAuthorizationResult *result;
/* check auth */
- result = polkit_authority_check_authorization_sync (polkit->priv->authority, subject, action_id, NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, NULL, &error_local);
+ result = polkit_authority_check_authorization_sync (polkit->priv->authority,
+ subject, action_id, NULL,
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+ NULL, &error_local);
if (result == NULL) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "failed to check authorisation: %s", error_local->message);
dbus_g_method_return_error (context, error);
@@ -104,11 +107,14 @@ up_polkit_is_allowed (UpPolkit *polkit, PolkitSubject *subject, const gchar *act
{
gboolean ret = FALSE;
GError *error;
- GError *error_local;
+ GError *error_local = NULL;
PolkitAuthorizationResult *result;
/* check auth */
- result = polkit_authority_check_authorization_sync (polkit->priv->authority, subject, action_id, NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE, NULL, &error_local);
+ result = polkit_authority_check_authorization_sync (polkit->priv->authority,
+ subject, action_id, NULL,
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
+ NULL, &error_local);
if (result == NULL) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "failed to check authorisation: %s", error_local->message);
dbus_g_method_return_error (context, error);

View File

@ -1,7 +1,7 @@
Summary: Power Management Service
Name: upower
Version: 0.9.5
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+
Group: System Environment/Libraries
URL: http://hal.freedesktop.org/releases/
@ -25,6 +25,9 @@ Requires: udev
Requires: pm-utils >= 1.2.2.1
Requires: gobject-introspection
# Upstream: don't crash with new polkits.
Patch0: upower-0.9.6-ensure-gerror-is-init.patch
# Old project name
Obsoletes: DeviceKit-power < 1:0.9.0-2
@ -49,6 +52,7 @@ Headers and libraries for UPower.
%prep
%setup -q
%patch0 -p1 -b .new-polkit
%build
%configure \
@ -108,6 +112,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
%{_includedir}/libupower-glib/upower.h
%changelog
* Tue Aug 10 2010 Richard Hughes <rhughes@redhat.com> - 0.9.5-5
- Ensure we've initialized errors when calling into PolicyKit.
- Resolves: #622830
* Mon Jul 26 2010 Bastien Nocera <bnocera@redhat.com> 0.9.5-4
- Add support for iDevice battery checking