summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-10-04 15:10:52 +0300
committerMartin Storsjö <martin@martin.st>2021-10-28 10:33:37 +0300
commit177176f75c6fa3f624d6d964b9d340ce39511565 (patch)
tree9ced378fba6679cb2b061a1206d9dde2a5130bfc /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
parent897c86dec5af2780d443edd852aa5911e2650ec6 (diff)
[Support] [Windows] Manually clean up temp files if not setting delete disposition
Since D81803 / 79657e2339b58bc01fe1b85a448bb073d57d90bb, temp files created on network shares don't set "Disposition.DeleteFile = true". This flag normally takes care of removing the temp file both if the process exits abnormally (either crashing or killed externally), and when the file is closed cleanly. For network shares, we voluntarily choose to not set the flag, and if the operation to inspect the file handle (as a prerequisite to setting the flag since 79657e2339b58bc01fe1b85a448bb073d57d90bb) fails we also error out. In both of these cases, we can at least make sure to remove the temp files when they are closed cleanly. Adjust the semantics of "OF_Delete" to not set the delete disposition, but only set the access mode for allowing deletion. Move the call to setDeleteDisposition into TempFile::create, where we can check if it failed, and if it did, set a flag noting that the file should be removed manually at the end. This does leak files on crash, but at least doesn't leak files in regular successful runs. (Technically, the alternative codepath could use the RemoveFileOnSignal function, but that might complicate the TempFile implementation further.) This fixes https://github.com/mstorsjo/llvm-mingw/issues/233 and https://bugs.llvm.org/show_bug.cgi?id=52080. Differential Revision: https://reviews.llvm.org/D111875
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
0 files changed, 0 insertions, 0 deletions