From: Mike Yuan Date: Tue, 9 Jan 2024 11:53:18 +0000 (+0800) Subject: hostnamed: use Type=notify X-Git-Tag: v256-rc1~1219^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9737e2c850c5ff547510d625a80fad890761a3b4;p=thirdparty%2Fsystemd.git hostnamed: use Type=notify --- diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index f01d771f9bc..0e06a16a241 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -14,6 +14,7 @@ #include "bus-log-control-api.h" #include "bus-polkit.h" #include "constants.h" +#include "daemon-util.h" #include "env-file-label.h" #include "env-file.h" #include "env-util.h" @@ -1733,6 +1734,10 @@ static int run(int argc, char *argv[]) { if (r < 0) return r; + r = sd_notify(false, NOTIFY_READY); + if (r < 0) + log_warning_errno(r, "Failed to send readiness notification, ignoring: %m"); + r = bus_event_loop_with_idle( context.event, context.bus, diff --git a/units/systemd-hostnamed.service.in b/units/systemd-hostnamed.service.in index 1cc15dd7cfd..ab00c24b53b 100644 --- a/units/systemd-hostnamed.service.in +++ b/units/systemd-hostnamed.service.in @@ -15,6 +15,7 @@ Documentation=man:machine-info(5) Documentation=man:org.freedesktop.hostname1(5) [Service] +Type=notify BusName=org.freedesktop.hostname1 CapabilityBoundingSet=CAP_SYS_ADMIN ExecStart={{LIBEXECDIR}}/systemd-hostnamed