summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-12-14 19:36:34 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-12-14 19:39:39 +0900
commit3c2f847227bd4d6e53a9c7d4518f82e072808e86 (patch)
tree91e066bba02642d21e712a0ded29c9b69442b3b3
parent372e8592c6e3a891174344be0899a91769ef61af (diff)
downloadsystemd-3c2f847227bd4d6e53a9c7d4518f82e072808e86.tar.gz
polkit: make bus_verify_polkit_async_registry_free() return Hashmap* with NULL
-rw-r--r--src/shared/bus-polkit.c7
-rw-r--r--src/shared/bus-polkit.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/shared/bus-polkit.c b/src/shared/bus-polkit.c
index 14122e0876..bbe04bea37 100644
--- a/src/shared/bus-polkit.c
+++ b/src/shared/bus-polkit.c
@@ -408,8 +408,11 @@ int bus_verify_polkit_async(
return -EACCES;
}
-void bus_verify_polkit_async_registry_free(Hashmap *registry) {
+Hashmap *bus_verify_polkit_async_registry_free(Hashmap *registry) {
#if ENABLE_POLKIT
- hashmap_free_with_destructor(registry, async_polkit_query_free);
+ return hashmap_free_with_destructor(registry, async_polkit_query_free);
+#else
+ assert(hashmap_isempty(registry));
+ return hashmap_free(registry);
#endif
}
diff --git a/src/shared/bus-polkit.h b/src/shared/bus-polkit.h
index 91a88a2807..e2a3b7eef6 100644
--- a/src/shared/bus-polkit.h
+++ b/src/shared/bus-polkit.h
@@ -8,4 +8,4 @@
int bus_test_polkit(sd_bus_message *call, int capability, const char *action, const char **details, uid_t good_user, bool *_challenge, sd_bus_error *e);
int bus_verify_polkit_async(sd_bus_message *call, int capability, const char *action, const char **details, bool interactive, uid_t good_user, Hashmap **registry, sd_bus_error *error);
-void bus_verify_polkit_async_registry_free(Hashmap *registry);
+Hashmap *bus_verify_polkit_async_registry_free(Hashmap *registry);