From 8790fcabf33a87c72056d3ed8cc2b8c233044d1d Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 25 Feb 2021 14:27:01 +0100 Subject: [PATCH] iwatch: minor, check if file/dir exists before trying to add Signed-off-by: Joachim Wiberg --- src/iwatch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/iwatch.c b/src/iwatch.c index ee241a66..5d183a8f 100644 --- a/src/iwatch.c +++ b/src/iwatch.c @@ -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);