summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/macosx/Symbols.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-02-01 05:15:02 +0000
committerGreg Clayton <gclayton@apple.com>2011-02-01 05:15:02 +0000
commit293d593294bb51d12b582532724215acdd08213d (patch)
treee014550cb336d39ab6bf5d5ff6e9861f4016cc3c /lldb/source/Host/macosx/Symbols.cpp
parent49916d786aeddb42f71d673893447d58461f236c (diff)
downloadbcm5719-llvm-293d593294bb51d12b582532724215acdd08213d.tar.gz
bcm5719-llvm-293d593294bb51d12b582532724215acdd08213d.zip
Added a cleanup helper object to make sure the directory that was opened with "DIR *opendir(const char *)" is closed if it is valid with a call to "int closedir (DIR *)".
llvm-svn: 124648
Diffstat (limited to 'lldb/source/Host/macosx/Symbols.cpp')
-rw-r--r--lldb/source/Host/macosx/Symbols.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp
index d4a3c01bd11..e91f3dd692b 100644
--- a/lldb/source/Host/macosx/Symbols.cpp
+++ b/lldb/source/Host/macosx/Symbols.cpp
@@ -25,6 +25,7 @@
#include "lldb/Core/Timer.h"
#include "lldb/Core/UUID.h"
#include "lldb/Host/Endian.h"
+#include "lldb/Utility/CleanUp.h"
#include "Host/macosx/cfcpp/CFCReleaser.h"
#include "mach/machine.h"
@@ -237,12 +238,12 @@ LocateDSYMMachFileInDSYMBundle
{
::strncat (path, "/Contents/Resources/DWARF", sizeof(path) - strlen(path) - 1);
- DIR* dirp = ::opendir(path);
- if (dirp != NULL)
+ lldb_utility::CleanUp <DIR *, int> dirp (opendir("containing_part"), NULL, closedir);
+ if (dirp.is_valid())
{
dsym_fspec.GetDirectory().SetCString(path);
struct dirent* dp;
- while ((dp = readdir(dirp)) != NULL)
+ while ((dp = readdir(dirp.get())) != NULL)
{
// Only search directories
if (dp->d_type == DT_DIR || dp->d_type == DT_UNKNOWN)
OpenPOWER on IntegriCloud