diff options
author | Gerd Moellmann <gerd@gnu.org> | 2001-03-08 14:16:36 +0000 |
---|---|---|
committer | Gerd Moellmann <gerd@gnu.org> | 2001-03-08 14:16:36 +0000 |
commit | f69f9da11ea89257d06ceaf8d927bbf5e1688566 (patch) | |
tree | a7e324dfe1d697e4bab076ddf75a7f62f1c72629 /src/dired.c | |
parent | 129004d3cb4e5f8f2ef7842b0ca2c49c515e3341 (diff) | |
download | emacs-f69f9da11ea89257d06ceaf8d927bbf5e1688566.tar.gz |
(directory_files_internal): Handle EAGAIN more
efficiently.
Diffstat (limited to 'src/dired.c')
-rw-r--r-- | src/dired.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/dired.c b/src/dired.c index ce2e5cb95b2..9deb44d3914 100644 --- a/src/dired.c +++ b/src/dired.c @@ -133,6 +133,7 @@ directory_files_internal_unwind (dh) /* 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 @@ directory_files_internal (directory, full, match, nosort, attrs) #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 @@ directory_files_internal (directory, full, match, nosort, attrs) } retry_p = 0; -#ifdef EAGAIN - retry_p |= errno == EAGAIN; -#endif #ifdef EINTR retry_p |= errno == EINTR; #endif |