mirror of
https://github.com/systemd/systemd
synced 2024-07-21 10:17:21 +00:00
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.
This commit is contained in:
parent
1ea7bda77f
commit
ac908152b3
|
@ -1682,6 +1682,13 @@ static int connect_varlink(Context *c) {
|
||||||
return 0;
|
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[]) {
|
static int run(int argc, char *argv[]) {
|
||||||
_cleanup_(context_destroy) Context context = {
|
_cleanup_(context_destroy) Context context = {
|
||||||
.hostname_source = _HOSTNAME_INVALID, /* appropriate value will be set later */
|
.hostname_source = _HOSTNAME_INVALID, /* appropriate value will be set later */
|
||||||
|
@ -1731,8 +1738,8 @@ static int run(int argc, char *argv[]) {
|
||||||
context.bus,
|
context.bus,
|
||||||
"org.freedesktop.hostname1",
|
"org.freedesktop.hostname1",
|
||||||
DEFAULT_EXIT_USEC,
|
DEFAULT_EXIT_USEC,
|
||||||
/* check_idle= */ NULL,
|
context_check_idle,
|
||||||
/* userdata= */ NULL);
|
&context);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to run event loop: %m");
|
return log_error_errno(r, "Failed to run event loop: %m");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue