mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
iwatch: ensure adding a new watcher is idempotent
Some subsystems call iwatch_add() without first calling iwatch_del() on the same path. E.g., cgroup_config(). Issue #417 but unclear atm. if this is the root cause. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -96,6 +96,12 @@ int iwatch_add1(struct iwatch *iw, char *file, uint32_t mask)
|
||||
if (!initialized)
|
||||
return -1;
|
||||
|
||||
iwp = iwatch_find_by_path(iw, file);
|
||||
if (iwp) {
|
||||
dbg("skipping, %s already registered", file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!fexist(file)) {
|
||||
dbg("skipping %s: no such file or directory", file);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user