iwatch: minor, check if file/dir exists before trying to add

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-02-25 14:27:01 +01:00
parent 3d9ee49759
commit 8790fcabf3
+4
View File
@@ -80,6 +80,10 @@ int iwatch_add(struct iwatch *iw, char *file, uint32_t mask)
if (!initialized)
return -1;
if (!fexist(file)) {
_d("No such file or directory, skipping %s", file);
return 0;
}
_d("Adding new watcher for path %s", file);
path = strdup(file);