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

Reply via email to