summaryrefslogtreecommitdiffstats
path: root/debian/patches/bus-util-treat-org.freedesktop.DBus.Error.ServiceUnknown-.patch
blob: ffd349f41253e925b0893d9b831c724220547437 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Thu, 4 Apr 2019 13:35:29 +0900
Subject: bus-util: treat org.freedesktop.DBus.Error.ServiceUnknown nicely
 when polkit does not exist

Fixes #12209.

(cherry picked from commit 8c69fe79df6394f6b8b8d0bb536a265caf417868)
(cherry picked from commit 0bb488b22144aeb87d93e97123f71babe116261f)
---
 src/shared/bus-util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 9d31fba..a406dd8 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -410,14 +410,14 @@ int bus_verify_polkit_async(
                 if (sd_bus_message_is_method_error(q->reply, NULL)) {
                         const sd_bus_error *e;
 
-                        /* Copy error from polkit reply */
                         e = sd_bus_message_get_error(q->reply);
-                        sd_bus_error_copy(error, e);
 
                         /* Treat no PK available as access denied */
                         if (sd_bus_error_has_name(e, SD_BUS_ERROR_SERVICE_UNKNOWN))
                                 return -EACCES;
 
+                        /* Copy error from polkit reply */
+                        sd_bus_error_copy(error, e);
                         return -sd_bus_error_get_errno(e);
                 }