From: Daniel Wagner Date: Tue, 13 Nov 2012 12:50:03 +0000 (+0100) Subject: inotify: Watch out for files moved to/from watched dirs X-Git-Tag: 1.10~136 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db4b9c326ebc4dda44a72b6832382301920925be;p=platform%2Fupstream%2Fconnman.git inotify: Watch out for files moved to/from watched dirs When we do not watch watch for IN_MOVED_TO or IN_MOVED_FROM we can easily inconsistent. The user creates a file and moves it then from the watched directory. We wouldn't see this change and therefore keep the configuration. That is a rather anoying behavoir for the policy plugin. --- diff --git a/src/inotify.c b/src/inotify.c index 6646f5e..f451f1c 100644 --- a/src/inotify.c +++ b/src/inotify.c @@ -116,7 +116,8 @@ static int create_watch(const char *path, struct connman_inotify *inotify) return -EIO; inotify->wd = inotify_add_watch(fd, path, - IN_MODIFY | IN_CREATE | IN_DELETE); + IN_MODIFY | IN_CREATE | IN_DELETE | + IN_MOVED_TO | IN_MOVED_FROM); if (inotify->wd < 0) { connman_error("Creation of %s watch failed", path); close(fd);