changeset 36665:e2b1703a8fe8

(directory_files_internal): Handle EAGAIN more efficiently.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 08 Mar 2001 14:16:36 +0000
parents 7424c33c6e76
children 2b284278da9c
files src/dired.c
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/dired.c	Thu Mar 08 14:03:45 2001 +0000
+++ b/src/dired.c	Thu Mar 08 14:16:36 2001 +0000
@@ -133,6 +133,7 @@
 /* Function shared by Fdirectory_files and Fdirectory_files_and_attributes.  
    When ATTRS is zero, return a list of directory filenames; when
    non-zero, return a list of directory filenames and their attributes.  */
+
 Lisp_Object
 directory_files_internal (directory, full, match, nosort, attrs)
      Lisp_Object directory, full, match, nosort;
@@ -209,9 +210,19 @@
 #endif /* not VMS */
 
   /* Loop reading blocks until EOF or error.  */
-  errno = 0;
-  while ((dp = readdir (d)) != NULL)
+  for (;;)
     {
+      errno = 0;
+      dp = readdir (d);
+
+#ifdef EAGAIN
+      if (dp == NULL && errno == EAGAIN)
+	continue;
+#endif
+      
+      if (dp == NULL)
+	break;
+
       if (DIRENTRY_NONEMPTY (dp))
 	{
 	  int len;
@@ -299,9 +310,6 @@
     }
 
   retry_p = 0;
-#ifdef EAGAIN
-  retry_p |= errno == EAGAIN;
-#endif
 #ifdef EINTR
   retry_p |= errno == EINTR;
 #endif