1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

Use the stat information in the Path object, if it is already obtained. This

avoids a call to ::fstat by MappedFile when the file size information was
already obtained by the Path object.

llvm-svn: 35477
This commit is contained in:
Reid Spencer 2007-03-29 19:11:22 +00:00
parent 4269ae1274
commit e35e9d07b0

View File

@ -54,15 +54,14 @@ bool MappedFile::initialize(std::string* ErrMsg) {
MakeErrMsg(ErrMsg, "can't open file '" + path_.toString() + "'");
return true;
}
struct stat sbuf;
if(::fstat(FD, &sbuf) < 0) {
MakeErrMsg(ErrMsg, "can't stat file '"+ path_.toString() + "'");
const FileStatus *Status = path_.getFileStatus(false, ErrMsg);
if (!Status) {
::close(FD);
return true;
}
info_ = new MappedFileInfo;
info_->FD = FD;
info_->Size = sbuf.st_size;
info_->Size = Status->getSize();
return false;
}