diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-06-11 16:42:42 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-06-11 16:42:42 +0000 |
commit | a6fe345ac9613215237fa3fcbae4e34119d4ecf0 (patch) | |
tree | 0d9cfedc22da7824bd3265731b6e62f9fd327a28 /llvm/lib/Support/Path.cpp | |
parent | 08200d6d26e98fce472fa530e980bc5dda5369d6 (diff) | |
download | bcm5719-llvm-a6fe345ac9613215237fa3fcbae4e34119d4ecf0.tar.gz bcm5719-llvm-a6fe345ac9613215237fa3fcbae4e34119d4ecf0.zip |
[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
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r-- | llvm/lib/Support/Path.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
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; } |