From 465bc17ca4b131f8c1ef27ff8279f4ea13745a78 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 28 Nov 2024 11:06:57 +0100 Subject: [PATCH] Fix unintended restart of template siblings Consider the case where container@.conf is an available template. When creating a container@foo.conf it will share the same base .conf as an existing container@bar.conf, but we do not expect to restart bar just because foo is instantiated. Up until this change, all template siblings were considered "dirty" if a new one was created or updated. Skipping realpath() for all files that have a '@' works around the problem. Signed-off-by: Joachim Wiberg --- src/conf.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/conf.c b/src/conf.c index 1cfcd872..531923c0 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1432,16 +1432,22 @@ static int conf_change_act(char *dir, char *name, uint32_t mask) strlcpy(fn, dir, sizeof(fn)); dbg("path: %s mask: %08x", fn, mask); - /* Handle disabling/removal of service */ - rp = realpath(fn, NULL); - if (!rp) { - if (errno != ENOENT) - goto fail; + if (strchr(name, '@')) { + /* Skip realpath for templates */ rp = strdup(fn); - if (!rp) - goto fail; + } else { + /* Handle disabling/removal of service */ + rp = realpath(fn, NULL); + if (!rp) { + if (errno != ENOENT) + goto fail; + rp = strdup(fn); + } } + if (!rp) + goto fail; + node = conf_find(rp); if (node) { dbg("event already registered for %s ...", name);