devmon: assert condition immediately if device already exists

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 <lazzer@gmail.com>
This commit is contained in:
Mattias Walström
2026-02-23 07:30:08 +01:00
parent 7aa9ed5982
commit f04fce544d
+5
View File
@@ -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 ?: "<NIL>");
@@ -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)