1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

bus-util: treat org.freedesktop.DBus.Error.ServiceUnknown nicely when polkit does not exist

Fixes #12209.
This commit is contained in:
Yu Watanabe 2019-04-04 13:35:29 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent ad2d50f840
commit 8c69fe79df

View File

@ -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);
}