From a6fe345ac9613215237fa3fcbae4e34119d4ecf0 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 11 Jun 2019 16:42:42 +0000 Subject: [Path] Set FD to -1 in moved-from TempFile When moving a temp file, explicitly set the file descriptor to -1 so we can never accidentally close the moved-from TempFile. Differential revision: https://reviews.llvm.org/D63087 llvm-svn: 363083 --- llvm/lib/Support/Path.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'llvm/lib/Support/Path.cpp') diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index 5312e1df3b6..c49260125db 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -1125,6 +1125,7 @@ TempFile &TempFile::operator=(TempFile &&Other) { TmpName = std::move(Other.TmpName); FD = Other.FD; Other.Done = true; + Other.FD = -1; return *this; } -- cgit v1.2.3