aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-03-08 14:16:36 +0000
committerGerd Moellmann2001-03-08 14:16:36 +0000
commitf69f9da11ea89257d06ceaf8d927bbf5e1688566 (patch)
treea7e324dfe1d697e4bab076ddf75a7f62f1c72629 /src
parent129004d3cb4e5f8f2ef7842b0ca2c49c515e3341 (diff)
downloademacs-f69f9da11ea89257d06ceaf8d927bbf5e1688566.tar.gz
emacs-f69f9da11ea89257d06ceaf8d927bbf5e1688566.zip
(directory_files_internal): Handle EAGAIN more
efficiently.
Diffstat (limited to 'src')
-rw-r--r--src/dired.c18
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)
133/* Function shared by Fdirectory_files and Fdirectory_files_and_attributes. 133/* Function shared by Fdirectory_files and Fdirectory_files_and_attributes.
134 When ATTRS is zero, return a list of directory filenames; when 134 When ATTRS is zero, return a list of directory filenames; when
135 non-zero, return a list of directory filenames and their attributes. */ 135 non-zero, return a list of directory filenames and their attributes. */
136
136Lisp_Object 137Lisp_Object
137directory_files_internal (directory, full, match, nosort, attrs) 138directory_files_internal (directory, full, match, nosort, attrs)
138 Lisp_Object directory, full, match, nosort; 139 Lisp_Object directory, full, match, nosort;
@@ -209,9 +210,19 @@ directory_files_internal (directory, full, match, nosort, attrs)
209#endif /* not VMS */ 210#endif /* not VMS */
210 211
211 /* Loop reading blocks until EOF or error. */ 212 /* Loop reading blocks until EOF or error. */
212 errno = 0; 213 for (;;)
213 while ((dp = readdir (d)) != NULL)
214 { 214 {
215 errno = 0;
216 dp = readdir (d);
217
218#ifdef EAGAIN
219 if (dp == NULL && errno == EAGAIN)
220 continue;
221#endif
222
223 if (dp == NULL)
224 break;
225
215 if (DIRENTRY_NONEMPTY (dp)) 226 if (DIRENTRY_NONEMPTY (dp))
216 { 227 {
217 int len; 228 int len;
@@ -299,9 +310,6 @@ directory_files_internal (directory, full, match, nosort, attrs)
299 } 310 }
300 311
301 retry_p = 0; 312 retry_p = 0;
302#ifdef EAGAIN
303 retry_p |= errno == EAGAIN;
304#endif
305#ifdef EINTR 313#ifdef EINTR
306 retry_p |= errno == EINTR; 314 retry_p |= errno == EINTR;
307#endif 315#endif