Jelajahi Sumber

Merge pull request #479 from richardkchapman/gh-478_readdir

gh-478 - CLinuxDirectoryIterator not threadsafe
Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 13 tahun lalu
induk
melakukan
d6da647dd9
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 2 1
      system/jlib/jfile.cpp

+ 2 - 1
system/jlib/jfile.cpp

@@ -3326,10 +3326,11 @@ public:
     bool next()
     {
         loop {
+            struct dirent dirEntry;
             struct dirent *entry;
             loop {
                 gotst = false;
-                entry = readdir(handle);  // don't need _r here 
+                readdir_r(handle, &dirEntry, &entry);
                 // need better checking here?
                 if (!entry)
                     break;