45 lines
2.0 KiB
Diff
45 lines
2.0 KiB
Diff
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);
|