6ee4abe797
Remove resolved scriptlets Don't install tests Resolves: RHEL-46277,RHEL-46576,RHEL-46280
44 lines
1.6 KiB
Diff
44 lines
1.6 KiB
Diff
From f2b5c1ff51b7c7876036c6c722e2a47b696695d9 Mon Sep 17 00:00:00 2001
|
|
From: Lennart Poettering <lennart@poettering.net>
|
|
Date: Wed, 8 May 2024 10:38:11 +0200
|
|
Subject: [PATCH] hostnamed: don't allow hostnamed to exit on idle if varlink
|
|
connections are still ongoing
|
|
|
|
And while we are at it, ongoing PK authorizations are also a reason to
|
|
block exit on idle.
|
|
|
|
(cherry picked from commit ac908152b3b43a49f793d225c075423422cd3e33)
|
|
---
|
|
src/hostname/hostnamed.c | 11 +++++++++--
|
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
|
|
index 82d08803fa..fe1216fc1c 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");
|
|
|