From f04fce544d784df7c01f470be1d57666e0587e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 23 Feb 2026 07:25:04 +0100 Subject: [PATCH] devmon: assert condition immediately if device already exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The config parsing happens after udev triggers the initial event, make sure to assert the condition if the device node exists when adding it from configuration. Signed-off-by: Mattias Walström --- src/devmon.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/devmon.c b/src/devmon.c index aa6b62ed..92b8e430 100644 --- a/src/devmon.c +++ b/src/devmon.c @@ -75,6 +75,7 @@ static void drop_node(struct dev_node *node) void devmon_add_cond(const char *cond) { struct dev_node *node; + char path[PATH_MAX]; if (!cond || strncmp(cond, "dev/", 4)) { // dbg("no match %s", cond ?: ""); @@ -103,6 +104,10 @@ void devmon_add_cond(const char *cond) node->refcnt = 1; TAILQ_INSERT_TAIL(&dev_node_list, node, link); + + snprintf(path, sizeof(path), "/%s", cond); + if (fexist(path)) + cond_set(cond); } void devmon_del_cond(const char *cond)