summaryrefslogtreecommitdiffstats
path: root/src/hostname/hostnamed.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:08:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:08:41 +0000
commite31cc1efd724903b9cfeca5c070978113586ed28 (patch)
tree59e1fe0085540c2dd20a2ffa171f0bb8c732f7d4 /src/hostname/hostnamed.c
parentAdding upstream version 256. (diff)
downloadsystemd-e31cc1efd724903b9cfeca5c070978113586ed28.tar.xz
systemd-e31cc1efd724903b9cfeca5c070978113586ed28.zip
Adding upstream version 256.1.upstream/256.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/hostname/hostnamed.c')
-rw-r--r--src/hostname/hostnamed.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 82d0880..fe1216f 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -1682,6 +1682,13 @@ static int connect_varlink(Context *c) {
return 0;
}
+static bool context_check_idle(void *userdata) {
+ Context *c = ASSERT_PTR(userdata);
+
+ return varlink_server_current_connections(c->varlink_server) == 0 &&
+ hashmap_isempty(c->polkit_registry);
+}
+
static int run(int argc, char *argv[]) {
_cleanup_(context_destroy) Context context = {
.hostname_source = _HOSTNAME_INVALID, /* appropriate value will be set later */
@@ -1731,8 +1738,8 @@ static int run(int argc, char *argv[]) {
context.bus,
"org.freedesktop.hostname1",
DEFAULT_EXIT_USEC,
- /* check_idle= */ NULL,
- /* userdata= */ NULL);
+ context_check_idle,
+ &context);
if (r < 0)
return log_error_errno(r, "Failed to run event loop: %m");