mirror of
https://github.com/troglobit/finit.git
synced 2026-11-08 16:11:10 +00: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:
1 file changed
+6
@@ -96,6 +96,12 @@ int iwatch_add1(struct iwatch *iw, char *file, uint32_t mask)
|
|||||||
if (!initialized)
|
if (!initialized)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
iwp = iwatch_find_by_path(iw, file);
|
||||||
|
if (iwp) {
|
||||||
|
dbg("skipping, %s already registered", file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!fexist(file)) {
|
if (!fexist(file)) {
|
||||||
dbg("skipping %s: no such file or directory", file);
|
dbg("skipping %s: no such file or directory", file);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in new issue
Block a user