From c065ad850cd17ce17c83453ccb96d5dc32d84494 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 18 Apr 2002 19:55:25 +0000 Subject: Make sure that there is no case where a signal can occur leaving a partially written output file. This is important because crashing testcases often write part of a file out, and the testing harness decides the file is up-to-date next time the test is run. llvm-svn: 2303 --- llvm/tools/link/link.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/tools/link/link.cpp') diff --git a/llvm/tools/link/link.cpp b/llvm/tools/link/link.cpp index c4be6715cff..6cb30a2bd4e 100644 --- a/llvm/tools/link/link.cpp +++ b/llvm/tools/link/link.cpp @@ -14,6 +14,7 @@ #include "llvm/Bytecode/Writer.h" #include "llvm/Module.h" #include "Support/CommandLine.h" +#include "Support/Signals.h" #include #include #include // For FileExists @@ -126,6 +127,10 @@ int main(int argc, char **argv) { cerr << "Error opening '" << OutputFilename << "'!\n"; return 1; } + + // Make sure that the Out file gets unlink'd from the disk if we get a + // SIGINT + RemoveFileOnSignal(OutputFilename); } if (Verbose) cerr << "Writing bytecode...\n"; -- cgit v1.2.3