summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Filesystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Filesystem.cpp')
-rw-r--r--lld/ELF/Filesystem.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lld/ELF/Filesystem.cpp b/lld/ELF/Filesystem.cpp
index b63d521a83b..d468ae0c618 100644
--- a/lld/ELF/Filesystem.cpp
+++ b/lld/ELF/Filesystem.cpp
@@ -38,7 +38,8 @@ using namespace lld::elf;
// This function spawns a background thread to call unlink.
// The calling thread returns almost immediately.
void elf::unlinkAsync(StringRef Path) {
- if (!Config->Threads || !sys::fs::exists(Config->OutputFile))
+ if (!Config->Threads || !sys::fs::exists(Config->OutputFile) ||
+ !sys::fs::is_regular_file(Config->OutputFile))
return;
// First, rename Path to avoid race condition. We cannot remove
OpenPOWER on IntegriCloud