From 8c69fe79df6394f6b8b8d0bb536a265caf417868 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 4 Apr 2019 13:35:29 +0900 Subject: [PATCH] bus-util: treat org.freedesktop.DBus.Error.ServiceUnknown nicely when polkit does not exist Fixes #12209. --- 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 00120e98741..e31fcfbd5a6 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); }