diff options
author | Matthias Clasen <matthias.clasen@gmail.com> | 2010-08-19 13:10:49 +0200 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2010-08-19 13:10:49 +0200 |
commit | 4a53c56a913b002d4f7e23b3379ccb134ed454db (patch) | |
tree | a18f89e96599b73805059fe18f8fe39a4633015e | |
parent | 3967e062ef5a58c4f3f283f34d591c6e8a5d8788 (diff) |
Fix up_polkit_get_subject() D-BUS error return
All callers of up_polkit_get_subject() just exit without returning an error to
the D-BUS caller if they fail to get the PolicyKit subject. Do that in
up_polkit_get_subject() itself now, for convenience.
Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
-rw-r--r-- | src/up-polkit.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/up-polkit.c b/src/up-polkit.c index ab2c66d..0ca2433 100644 --- a/src/up-polkit.c +++ b/src/up-polkit.c @@ -52,12 +52,19 @@ static gpointer up_polkit_object = NULL; PolkitSubject * up_polkit_get_subject (UpPolkit *polkit, DBusGMethodInvocation *context) { + GError *error; const gchar *sender; PolkitSubject *subject; sender = dbus_g_method_get_sender (context); subject = polkit_system_bus_name_new (sender); + if (subject == NULL) { + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "failed to get PolicyKit subject"); + dbus_g_method_return_error (context, error); + g_error_free (error); + } + return subject; } |