From 7beca6e20f232adb8bb79aa55b3eba900dc8b8de Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 26 Jun 2014 13:27:11 -0700 Subject: Remove the rcc output file if we failed to write it This happens if the second pass failed to find the signature data in the compiled output, which can happen if the compiler is not *actually* compiling anything (LTO / LTCG mode). If we left the unmodified file in the output, make would continue running next time it was invoked, resulting in bad data. Change-Id: I97f23a89a1ca1f8b8c449b0744de3f0c78daa706 Reviewed-by: hjk --- src/tools/rcc/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp index 99833101d2..5ded9a9b78 100644 --- a/src/tools/rcc/main.cpp +++ b/src/tools/rcc/main.cpp @@ -283,7 +283,13 @@ int runRcc(int argc, char *argv[]) return 1; } } - return library.output(out, temp, errorDevice) ? 0 : 1; + bool success = library.output(out, temp, errorDevice); + if (!success) { + // erase the output file if we failed + out.remove(); + return 1; + } + return 0; } Q_CORE_EXPORT extern QBasicAtomicInt qt_qhash_seed; // from qhash.cpp -- cgit v1.2.3