summaryrefslogtreecommitdiff
path: root/src/dired.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-09-11 23:22:46 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-09-11 23:23:22 -0700
commitf7228a6479cc8c88a23138980d958c4c431dd6a5 (patch)
tree4e3ded6342bfebf5ab3bc871ec4ad4c2fdba2c85 /src/dired.c
parentef926ce3b6a078039303ae210e599dc4d3faa13b (diff)
downloademacs-f7228a6479cc8c88a23138980d958c4c431dd6a5.tar.gz
emacs-f7228a6479cc8c88a23138980d958c4c431dd6a5.tar.bz2
emacs-f7228a6479cc8c88a23138980d958c4c431dd6a5.zip
Fix directory-files-and-attributes race
* src/dired.c (directory_files_internal): Fix race condition: when some other process removed a file between the readdir and the ensuing lstat, directory-files-and-attributes would return a list containing nil.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dired.c b/src/dired.c
index 7bc4b83fd77..58fa848e2e3 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -295,7 +295,8 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
{
Lisp_Object fileattrs
= file_attributes (fd, dp->d_name, directory, name, id_format);
- list = Fcons (Fcons (finalname, fileattrs), list);
+ if (!NILP (fileattrs))
+ list = Fcons (Fcons (finalname, fileattrs), list);
}
else
list = Fcons (finalname, list);