1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Try to open the file before use data from stat.

Looks like on mingw we get bogus last modification times on directories.
Should fix the mingw bots.

llvm-svn: 186240
This commit is contained in:
Rafael Espindola 2013-07-13 05:07:22 +00:00
parent a4d4dfc5bc
commit 5910a296f4

View File

@ -560,6 +560,9 @@ static void performWriteOperation(ArchiveOperation Operation,
sys::fs::file_status Status; sys::fs::file_status Status;
failIfError(sys::fs::status(FileName, Status), FileName); failIfError(sys::fs::status(FileName, Status), FileName);
OwningPtr<MemoryBuffer> File;
failIfError(MemoryBuffer::getFile(FileName, File), FileName);
uint64_t secondsSinceEpoch = uint64_t secondsSinceEpoch =
Status.getLastModificationTime().toEpochTime(); Status.getLastModificationTime().toEpochTime();
printWithSpacePadding(Out, secondsSinceEpoch, 12); printWithSpacePadding(Out, secondsSinceEpoch, 12);
@ -570,8 +573,6 @@ static void performWriteOperation(ArchiveOperation Operation,
printWithSpacePadding(Out, Status.getSize(), 10); printWithSpacePadding(Out, Status.getSize(), 10);
Out << "`\n"; Out << "`\n";
OwningPtr<MemoryBuffer> File;
failIfError(MemoryBuffer::getFile(FileName, File), FileName);
Out << File->getBuffer(); Out << File->getBuffer();
} else { } else {
object::Archive::child_iterator OldMember = I->getOld(); object::Archive::child_iterator OldMember = I->getOld();