[Lldb-commits] [lldb] r125008 - /lldb/trunk/source/Core/FileSpec.cpp

Greg Clayton gclayton at apple.com
Mon Feb 7 09:41:11 PST 2011


Author: gclayton
Date: Mon Feb  7 11:41:11 2011
New Revision: 125008

URL: http://llvm.org/viewvc/llvm-project?rev=125008&view=rev
Log:
Posix compatability patch from Jai Menon to avoid uses dirent struct members
that aren't always available (sometimes d_namlen or d_reclen). Now strlen is
used to avoid such issues.


Modified:
    lldb/trunk/source/Core/FileSpec.cpp

Modified: lldb/trunk/source/Core/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FileSpec.cpp?rev=125008&r1=125007&r2=125008&view=diff
==============================================================================
--- lldb/trunk/source/Core/FileSpec.cpp (original)
+++ lldb/trunk/source/Core/FileSpec.cpp Mon Feb  7 11:41:11 2011
@@ -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;
                 }
             





More information about the lldb-commits mailing list