Jai ++

I am experiencing another problem in relation to this same code:  the d_type is 
also not mentioned in the URL you site, and the build i am attempting under 
MinGW fails because of this.

This patch looks like a reasonable start.  I may have to build onto it to make 
it more cross-platform friendly with windows.

++ Kirk

On 2011-Feb-4, at 7:46 PM, ext Jai Menon wrote:

Hello,

Revision 124716 introduced some code to enumerate directories which
isn't quite POSIX compatible. Specifically, the 'd_namlen' entry isn't
guaranteed to be present in POSIX compatible environments [1] (for
example, on linux/glibc, the entry is 'd_reclen'). Attached patch
fixes this.


1. http://pubs.opengroup.org/onlinepubs/009695399/basedefs/dirent.h.html

--
Jai Menon
Index: source/Core/FileSpec.cpp
===================================================================
--- source/Core/FileSpec.cpp	(revision 124932)
+++ source/Core/FileSpec.cpp	(working copy)
@@ -12,6 +12,7 @@
 #include <fcntl.h>
 #include <libgen.h>
 #include <sys/stat.h>
+#include <string.h>
 
 #if LLDB_CONFIG_TILDE_RESOLVES_TO_USER
 #include <pwd.h>
@@ -837,10 +838,12 @@
                 // Only search directories
                 if (dp->d_type == DT_DIR || dp->d_type == DT_UNKNOWN)
                 {
-                    if (dp->d_namlen == 1 && dp->d_name[0] == '.')
+                    size_t len = strlen(dp->d_name);
+
+                    if (len == 1 && dp->d_name[0] == '.')
                         continue;
 
-                    if (dp->d_namlen == 2 && dp->d_name[0] == '.' && dp->d_name[1] == '.')
+                    if (len == 2 && dp->d_name[0] == '.' && dp->d_name[1] == '.')
                         continue;
                 }
             
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev


++ kirk beitz : nokia : austin + san diego 
: [email protected] ++



_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to