summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/DataBufferMemoryMap.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-01-06 00:43:54 +0000
committerGreg Clayton <gclayton@apple.com>2012-01-06 00:43:54 +0000
commit650e3b014ea230203bebd8a293c893cdb6b3727e (patch)
tree6a82331a00f1e59ef3f72ca2be908354d3a8ce1d /lldb/source/Core/DataBufferMemoryMap.cpp
parentb49440fa92c1cbdea3736acdb0882275c1ab0748 (diff)
downloadbcm5719-llvm-650e3b014ea230203bebd8a293c893cdb6b3727e.tar.gz
bcm5719-llvm-650e3b014ea230203bebd8a293c893cdb6b3727e.zip
<rdar://problem/10647191>
Removed an extra call to close that was causing problems and also now use the Host::File class to open the file. llvm-svn: 147638
Diffstat (limited to 'lldb/source/Core/DataBufferMemoryMap.cpp')
-rw-r--r--lldb/source/Core/DataBufferMemoryMap.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp
index dfeced0b025..a6c6f8aeeeb 100644
--- a/lldb/source/Core/DataBufferMemoryMap.cpp
+++ b/lldb/source/Core/DataBufferMemoryMap.cpp
@@ -16,6 +16,7 @@
#include "lldb/Core/DataBufferMemoryMap.h"
#include "lldb/Core/Error.h"
+#include "lldb/Host/File.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
@@ -106,25 +107,18 @@ DataBufferMemoryMap::MemoryMapFromFileSpec (const FileSpec* file,
char path[PATH_MAX];
if (file->GetPath(path, sizeof(path)))
{
- int oflag = 0;
+ uint32_t options = File::eOpenOptionRead;
if (writeable)
- oflag = O_RDWR;
- else
- oflag = O_RDONLY;
+ options |= File::eOpenOptionWrite;
- int fd = ::open(path, oflag, 0);
- if (fd >= 0)
+ File file;
+ Error error (file.Open(path, options));
+ if (error.Success())
{
const bool fd_is_file = true;
- MemoryMapFromFileDescriptor (fd, offset, length, writeable, fd_is_file);
- ::close(fd);
+ MemoryMapFromFileDescriptor (file.GetDescriptor(), offset, length, writeable, fd_is_file);
return GetByteSize();
}
- else
- {
- //error.SetErrorToErrno();
- return 0;
- }
}
}
// We should only get here if there was an error
@@ -225,8 +219,6 @@ DataBufferMemoryMap::MemoryMapFromFileDescriptor (int fd,
}
}
}
-
- ::close (fd);
}
return GetByteSize ();
}
OpenPOWER on IntegriCloud