瀏覽代碼

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

gh-478 - CLinuxDirectoryIterator not threadsafe
Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 13 年之前
父節點
當前提交
d6da647dd9
共有 1 個文件被更改,包括 2 次插入1 次删除
  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;