From 0b2d37205d738bf702e839b2b21d582c50cffaa2 Mon Sep 17 00:00:00 2001 From: Alex Light Date: Tue, 25 Jul 2017 11:17:05 -0700 Subject: [PATCH] Make cppreopts cleanup if it fails Previously we would simply leave temporary files lying around if we failed to rename them for some reason. This change makes us attempt to clean the temporary files up. Test: Phone boots. Bug: 63995897 Change-Id: Ib876a626904bec090fe4f3bd228335feadb6a7c7 --- cppreopts/cppreopts.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cppreopts/cppreopts.sh b/cppreopts/cppreopts.sh index 9f21ac78..8a0d4668 100644 --- a/cppreopts/cppreopts.sh +++ b/cppreopts/cppreopts.sh @@ -31,6 +31,7 @@ function do_copy() { sync if ! mv ${temp_dest_name} ${dest_name} ; then log -p w -t cppreopts "Unable to rename temporary file from ${temp_dest_name} to ${dest_name}" + rm ${temp_dest_name} || log -p w -t cppreopts "Unable to remove temporary file ${temp_dest_name}" else log -p i -t cppreopts "Renamed temporary file from ${temp_dest_name} to ${dest_name}" fi -- 2.11.0