[Lldb-commits] [lldb] r147638 - /lldb/trunk/source/Core/DataBufferMemoryMap.cpp
Greg Clayton
gclayton at apple.com
Thu Jan 5 16:43:54 PST 2012
Author: gclayton
Date: Thu Jan 5 18:43:54 2012
New Revision: 147638
URL: http://llvm.org/viewvc/llvm-project?rev=147638&view=rev
Log:
<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.
Modified:
lldb/trunk/source/Core/DataBufferMemoryMap.cpp
Modified: lldb/trunk/source/Core/DataBufferMemoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataBufferMemoryMap.cpp?rev=147638&r1=147637&r2=147638&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataBufferMemoryMap.cpp (original)
+++ lldb/trunk/source/Core/DataBufferMemoryMap.cpp Thu Jan 5 18:43:54 2012
@@ -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 @@
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 @@
}
}
}
-
- ::close (fd);
}
return GetByteSize ();
}
More information about the lldb-commits
mailing list