]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix directory-files-and-attributes race
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 12 Sep 2019 06:22:46 +0000 (23:22 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 12 Sep 2019 06:23:22 +0000 (23:23 -0700)
* 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.

src/dired.c

index 7bc4b83fd775f2af21199e80e9a463ad4f5e1793..58fa848e2e3c30c07eb6545709a9ca08c51a07e4 100644 (file)
@@ -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);