Dennis Knochenwefel has proposed merging lp:~zorba-coders/zorba/bug-1023862 
into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Till Westmann (tillw)
Related bugs:
  Bug #1023862 in Zorba: "file:list($path, true()) can produce infinite loops 
on some filesystems"
  https://bugs.launchpad.net/zorba/+bug/1023862

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1023862/+merge/114621

fix for bug #1023862
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1023862/+merge/114621
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/util/fs_util.cpp'
--- src/util/fs_util.cpp	2012-07-11 04:46:41 +0000
+++ src/util/fs_util.cpp	2012-07-12 12:06:23 +0000
@@ -335,6 +335,21 @@
         case DT_REG:
           ent_type_ = file;
           break;
+        case DT_UNKNOWN: {
+          // d_type is not supported by all filesystem types. If it is not supported
+          // d_type will be set to DT_UNKNOWN. To make sure that we skip '.' and '..'
+          // in any case we have to make an explicit stat() to find out the file type.
+          // see also bug #1023862 or readdir manpage
+          char const *const name = ent_->d_name;
+          zstring lEntry(dir_path_);
+          lEntry.append("/").append(name);
+          ent_type_ = get_type(lEntry.c_str());
+          // skip "." and ".." entries
+          if ( ent_type_ == directory &&
+               name[0] == '.' && (!name[1] || (name[1] == '.' && !name[2])) )
+            continue;
+          break;
+        }
         default:
           ent_type_ = other;
       }

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to