aboutsummaryrefslogtreecommitdiffstats
path: root/src/kqueue.c
diff options
context:
space:
mode:
authorPaul Eggert2017-08-25 12:44:52 -0700
committerPaul Eggert2017-08-25 13:19:45 -0700
commit2b7e009257a40ef1dcad9845fe61764fea08cdea (patch)
tree416594c77bd7b015763726f48ee160e25a47fa61 /src/kqueue.c
parent9a223dab9036ff72b16e7a9878af090c041fd0c6 (diff)
downloademacs-2b7e009257a40ef1dcad9845fe61764fea08cdea.tar.gz
emacs-2b7e009257a40ef1dcad9845fe61764fea08cdea.zip
Fix file-attributes race on GNU hosts
* doc/lispref/files.texi (File Attributes): Document file-attributes atomicity. * etc/NEWS: Document the fix. * src/dired.c (file_attributes): New args DIRNAME and FILENAME, for diagnostics. All callers changed. On platforms like GNU/Linux that support O_PATH, fix a race condition in file-attributes and similar functions, so that these functions do not return nonsense if a directory entry is replaced while getting its attributes. On non-GNU platforms, do a better (though not perfect) job of detecting the race, and return nil if detected.
Diffstat (limited to 'src/kqueue.c')
-rw-r--r--src/kqueue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/kqueue.c b/src/kqueue.c
index a8eb4cb797c..30922ef28b1 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -130,7 +130,7 @@ kqueue_compare_dir_list (Lisp_Object watch_object)
130 return; 130 return;
131 } 131 }
132 new_directory_files = 132 new_directory_files =
133 directory_files_internal (dir, Qnil, Qnil, Qnil, 1, Qnil); 133 directory_files_internal (dir, Qnil, Qnil, Qnil, true, Qnil);
134 new_dl = kqueue_directory_listing (new_directory_files); 134 new_dl = kqueue_directory_listing (new_directory_files);
135 135
136 /* Parse through the old list. */ 136 /* Parse through the old list. */
@@ -453,7 +453,7 @@ only when the upper directory of the renamed file is watched. */)
453 if (NILP (Ffile_directory_p (file))) 453 if (NILP (Ffile_directory_p (file)))
454 watch_object = list4 (watch_descriptor, file, flags, callback); 454 watch_object = list4 (watch_descriptor, file, flags, callback);
455 else { 455 else {
456 dir_list = directory_files_internal (file, Qnil, Qnil, Qnil, 1, Qnil); 456 dir_list = directory_files_internal (file, Qnil, Qnil, Qnil, true, Qnil);
457 watch_object = list5 (watch_descriptor, file, flags, callback, dir_list); 457 watch_object = list5 (watch_descriptor, file, flags, callback, dir_list);
458 } 458 }
459 watch_list = Fcons (watch_object, watch_list); 459 watch_list = Fcons (watch_object, watch_list);