Skip to content

Commit

Permalink
Fix unintended restart of template siblings
Browse files Browse the repository at this point in the history
Consider the case where [email protected] is an available template.  When
creating a [email protected] it will share the same base .conf as an
existing [email protected], 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 <[email protected]>
  • Loading branch information
troglobit committed Nov 28, 2024
1 parent d4889b4 commit 465bc17
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 465bc17

Please sign in to comment.