aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2017-05-27 10:54:25 -0700
committerPaul Eggert2017-05-27 11:14:30 -0700
commitd387305062d9dab78b9c3cdc96090496eaf5a1c3 (patch)
tree5758743a5775d703850dcdd4dcec66f0e946abc8 /src
parentad656a726fc2683b0ca5683fcaaf6852f2c876b2 (diff)
downloademacs-d387305062d9dab78b9c3cdc96090496eaf5a1c3.tar.gz
emacs-d387305062d9dab78b9c3cdc96090496eaf5a1c3.zip
Depromiscuify inotify with IN_MASK_ADD
Use IN_MASK_ADD instead of using a no-longer-promiscuous-enough mask. This simplifies the code and restores the ability to use IN_ACCESS, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, and IN_OPEN in some cases (Bug#26973). * src/inotify.c (INOTIFY_DEFAULT_MASK): Remove. (Finotify_add_watch): Use IN_MASK_ADD instead.
Diffstat (limited to 'src')
-rw-r--r--src/inotify.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/inotify.c b/src/inotify.c
index b3e07286902..3d5d3d2621f 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -42,21 +42,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42# define IN_ONLYDIR 0 42# define IN_ONLYDIR 0
43#endif 43#endif
44 44
45/* Events that inotify-add-watch waits for. This list has all the
46 events that any watcher could include, because we want to support
47 multiple watches on the same file even though inotify uses the same
48 descriptor for all watches to that file. This list omits
49 IN_ACCESS, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, and IN_OPEN because
50 they would prevent other processes from reading; see Bug#26973.
51
52 FIXME: Explain why it is OK to omit these four bits here even
53 though a inotify-add-watch call might specify them. */
54
55#define INOTIFY_DEFAULT_MASK \
56 (IN_ATTRIB | IN_CREATE | IN_DELETE | IN_DELETE_SELF \
57 | IN_IGNORED | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM \
58 | IN_MOVED_TO | IN_EXCL_UNLINK)
59
60/* File handle for inotify. */ 45/* File handle for inotify. */
61static int inotifyfd = -1; 46static int inotifyfd = -1;
62 47
@@ -436,8 +421,7 @@ IN_ONESHOT */)
436 Lisp_Object encoded_file_name; 421 Lisp_Object encoded_file_name;
437 int wd = -1; 422 int wd = -1;
438 uint32_t imask = aspect_to_inotifymask (aspect); 423 uint32_t imask = aspect_to_inotifymask (aspect);
439 uint32_t mask = (INOTIFY_DEFAULT_MASK 424 uint32_t mask = imask | IN_MASK_ADD | IN_EXCL_UNLINK;
440 | (imask & (IN_DONT_FOLLOW | IN_ONLYDIR)));
441 425
442 CHECK_STRING (filename); 426 CHECK_STRING (filename);
443 427