[PATCH] D52666: [LLD][COFF] Fix pdb loading when the path points to a removable device
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 28 14:55:22 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD343366: [LLD][COFF] Fix pdb loading when the path points to a removable device (authored by aganea, committed by ).
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D52666
Files:
COFF/PDB.cpp
Index: COFF/PDB.cpp
===================================================================
--- COFF/PDB.cpp
+++ COFF/PDB.cpp
@@ -351,6 +351,12 @@
static Expected<std::unique_ptr<pdb::NativeSession>>
tryToLoadPDB(const GUID &GuidFromObj, StringRef TSPath) {
+ // Ensure the file exists before anything else. We want to return ENOENT,
+ // "file not found", even if the path points to a removable device (in which
+ // case the return message would be EAGAIN, "resource unavailable try again")
+ if (!llvm::sys::fs::exists(TSPath))
+ return errorCodeToError(std::error_code(ENOENT, std::generic_category()));
+
ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr = MemoryBuffer::getFile(
TSPath, /*FileSize=*/-1, /*RequiresNullTerminator=*/false);
if (!MBOrErr)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52666.167553.patch
Type: text/x-patch
Size: 776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180928/bd98da16/attachment.bin>
More information about the llvm-commits
mailing list