# HG changeset patch # User Gerd Moellmann # Date 984060996 0 # Node ID e2b1703a8fe8a5b476aef72f483b8acc17ab471e # Parent 7424c33c6e766786458a977163d9e5525a28e463 (directory_files_internal): Handle EAGAIN more efficiently. diff -r 7424c33c6e76 -r e2b1703a8fe8 src/dired.c --- 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