+2000-11-15 Gerd Moellmann <gerd@gnu.org>
+
+ * dired.c (directory_files_internal) [EAGAIN || EINTR]: Retry
+ reading the directory if readdir returns null and errno is EAGAIN
+ or EINTR.
+
2000-11-14 Stefan Monnier <monnier@cs.yale.edu>
* xdisp.c (try_scrolling): Set scroll_max to max of scroll_* args
int needsep = 0;
int count = specpdl_ptr - specpdl;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
+ DIRENTRY *dp;
+ int retry_p;
/* Because of file name handlers, these functions might call
Ffuncall, and cause a GC. */
an error is signaled while the directory stream is open, we
have to make sure it gets closed, and setting up an
unwind_protect to do so would be a pain. */
+ retry:
+
d = opendir (XSTRING (dirfilename)->data);
if (d == NULL)
report_file_error ("Opening directory", Fcons (directory, Qnil));
needsep = 1;
#endif /* not VMS */
- /* Loop reading blocks */
- while (1)
+ /* Loop reading blocks until EOF or error. */
+ while ((dp = readdir (d)) != NULL)
{
- DIRENTRY *dp = readdir (d);
-
- if (dp == NULL)
- break;
-
if (DIRENTRY_NONEMPTY (dp))
{
int len;
}
}
+ retry_p = 0;
+#ifdef EAGAIN
+ retry_p |= errno == EAGAIN;
+#endif
+#ifdef EINTR
+ retry_p |= errno == EINTR;
+#endif
+
closedir (d);
/* Discard the unwind protect. */
specpdl_ptr = specpdl + count;
+ if (retry_p)
+ goto retry;
+
if (NILP (nosort))
list = Fsort (Fnreverse (list),
attrs ? Qfile_attributes_lessp : Qstring_lessp);