summaryrefslogtreecommitdiff
path: root/lib/Support/MemoryBuffer.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-12-15 18:09:07 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-12-15 18:09:07 +0000
commit571945e6affd20b19264ec22495da418d0fbdbb4 (patch)
tree076117cdf3579003f07cad4cdf0593347ce58150 /lib/Support/MemoryBuffer.cpp
parent06f9d4012fb8acea3e9861d5722b5965dbb724d9 (diff)
Notes
Diffstat (limited to 'lib/Support/MemoryBuffer.cpp')
-rw-r--r--lib/Support/MemoryBuffer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index b04864a1a680..df1aa6a25d08 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/lib/Support/MemoryBuffer.cpp
@@ -176,7 +176,7 @@ MemoryBuffer *MemoryBuffer::getFile(StringRef Filename, std::string *ErrStr,
#endif
int FD = ::open(Filename.str().c_str(), O_RDONLY|OpenFlags);
if (FD == -1) {
- if (ErrStr) *ErrStr = "could not open file";
+ if (ErrStr) *ErrStr = strerror(errno);
return 0;
}
@@ -186,7 +186,7 @@ MemoryBuffer *MemoryBuffer::getFile(StringRef Filename, std::string *ErrStr,
struct stat FileInfo;
// TODO: This should use fstat64 when available.
if (fstat(FD, &FileInfo) == -1) {
- if (ErrStr) *ErrStr = "could not get file length";
+ if (ErrStr) *ErrStr = strerror(errno);
::close(FD);
return 0;
}
@@ -230,8 +230,8 @@ MemoryBuffer *MemoryBuffer::getFile(StringRef Filename, std::string *ErrStr,
// try again
} else {
// error reading.
+ if (ErrStr) *ErrStr = strerror(errno);
close(FD);
- if (ErrStr) *ErrStr = "error reading file data";
return 0;
}
}