diff options
author | Alex Light <allight@google.com> | 2017-07-25 11:17:05 -0700 |
---|---|---|
committer | Alex Light <allight@google.com> | 2017-08-23 09:02:46 -0700 |
commit | 0b2d37205d738bf702e839b2b21d582c50cffaa2 (patch) | |
tree | b88c5d9670eadc74808e770fe02adb6aa430d014 /cppreopts | |
parent | 005fc035cb2bde2f11b4380961601bf32da4ec32 (diff) | |
download | extras-0b2d37205d738bf702e839b2b21d582c50cffaa2.tar.gz |
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
Diffstat (limited to 'cppreopts')
-rw-r--r-- | cppreopts/cppreopts.sh | 1 |
1 files changed, 1 insertions, 0 deletions
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 |