aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-11-15 12:34:58 +0000
committerGerd Moellmann2000-11-15 12:34:58 +0000
commit8e42f043315b3f86491a569caa54c0365954e475 (patch)
treea1dc039f45a32cb6899a3e9f9d199bdfc3bcf04e /src
parent82bc80bfce8aed0bf4fbdc4c03b289907927acef (diff)
downloademacs-8e42f043315b3f86491a569caa54c0365954e475.tar.gz
emacs-8e42f043315b3f86491a569caa54c0365954e475.zip
(directory_files_internal) [EAGAIN || EINTR]: Retry
reading the directory if readdir returns null and errno is EAGAIN or EINTR.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/dired.c24
2 files changed, 23 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4ba3ced9541..76d96f7bb39 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12000-11-15 Gerd Moellmann <gerd@gnu.org>
2
3 * dired.c (directory_files_internal) [EAGAIN || EINTR]: Retry
4 reading the directory if readdir returns null and errno is EAGAIN
5 or EINTR.
6
12000-11-14 Stefan Monnier <monnier@cs.yale.edu> 72000-11-14 Stefan Monnier <monnier@cs.yale.edu>
2 8
3 * xdisp.c (try_scrolling): Set scroll_max to max of scroll_* args 9 * xdisp.c (try_scrolling): Set scroll_max to max of scroll_* args
diff --git a/src/dired.c b/src/dired.c
index 9fd9bffc4f1..bcfe8ddd820 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -144,6 +144,8 @@ directory_files_internal (directory, full, match, nosort, attrs)
144 int needsep = 0; 144 int needsep = 0;
145 int count = specpdl_ptr - specpdl; 145 int count = specpdl_ptr - specpdl;
146 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 146 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
147 DIRENTRY *dp;
148 int retry_p;
147 149
148 /* Because of file name handlers, these functions might call 150 /* Because of file name handlers, these functions might call
149 Ffuncall, and cause a GC. */ 151 Ffuncall, and cause a GC. */
@@ -182,6 +184,8 @@ directory_files_internal (directory, full, match, nosort, attrs)
182 an error is signaled while the directory stream is open, we 184 an error is signaled while the directory stream is open, we
183 have to make sure it gets closed, and setting up an 185 have to make sure it gets closed, and setting up an
184 unwind_protect to do so would be a pain. */ 186 unwind_protect to do so would be a pain. */
187 retry:
188
185 d = opendir (XSTRING (dirfilename)->data); 189 d = opendir (XSTRING (dirfilename)->data);
186 if (d == NULL) 190 if (d == NULL)
187 report_file_error ("Opening directory", Fcons (directory, Qnil)); 191 report_file_error ("Opening directory", Fcons (directory, Qnil));
@@ -203,14 +207,9 @@ directory_files_internal (directory, full, match, nosort, attrs)
203 needsep = 1; 207 needsep = 1;
204#endif /* not VMS */ 208#endif /* not VMS */
205 209
206 /* Loop reading blocks */ 210 /* Loop reading blocks until EOF or error. */
207 while (1) 211 while ((dp = readdir (d)) != NULL)
208 { 212 {
209 DIRENTRY *dp = readdir (d);
210
211 if (dp == NULL)
212 break;
213
214 if (DIRENTRY_NONEMPTY (dp)) 213 if (DIRENTRY_NONEMPTY (dp))
215 { 214 {
216 int len; 215 int len;
@@ -295,11 +294,22 @@ directory_files_internal (directory, full, match, nosort, attrs)
295 } 294 }
296 } 295 }
297 296
297 retry_p = 0;
298#ifdef EAGAIN
299 retry_p |= errno == EAGAIN;
300#endif
301#ifdef EINTR
302 retry_p |= errno == EINTR;
303#endif
304
298 closedir (d); 305 closedir (d);
299 306
300 /* Discard the unwind protect. */ 307 /* Discard the unwind protect. */
301 specpdl_ptr = specpdl + count; 308 specpdl_ptr = specpdl + count;
302 309
310 if (retry_p)
311 goto retry;
312
303 if (NILP (nosort)) 313 if (NILP (nosort))
304 list = Fsort (Fnreverse (list), 314 list = Fsort (Fnreverse (list),
305 attrs ? Qfile_attributes_lessp : Qstring_lessp); 315 attrs ? Qfile_attributes_lessp : Qstring_lessp);