From 751b22f4db7e252151affff704da4bc837146045 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Mon, 8 May 2023 22:45:23 +0200 Subject: [PATCH] confd: Avoid futile attempts to reload finit's config during boot finit is not ready to accept the messages anyway, so we end up waiting for the 2s timeout (2 times). Since finit won't setup a utmp entry until it leaves runlevel S, we use that as the sync point for when finit is ready to receive reloads. --- src/confd/src/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/confd/src/core.c b/src/confd/src/core.c index 76c2649b..4adda853 100644 --- a/src/confd/src/core.c +++ b/src/confd/src/core.c @@ -17,6 +17,10 @@ static int startup_save_hook(sr_session_ctx_t *session, uint32_t sub_id, const c static int commit_done_hook(sr_session_ctx_t *session, uint32_t sub_id, const char *module, const char *xpath, sr_event_t event, unsigned request_id, void *priv) { + /* No need to reload if the system is still bootstrapping. */ + if (system("runlevel >/dev/null")) + return SR_ERR_OK; + if (system("initctl -nbq reload")) return SR_ERR_SYS;