OSDN Git Service

Always remove the temporary zip file.
authorFelipe Leme <felipeal@google.com>
Tue, 15 Nov 2016 19:48:26 +0000 (11:48 -0800)
committerFelipe Leme <felipeal@google.com>
Tue, 15 Nov 2016 19:52:17 +0000 (11:52 -0800)
During N development, this file was only removed on user builds.

Change-Id: I16eba3905301662b802986d27cb8fcf6e0e34e01
Fixes: 32906722
Test: manual verification

cmds/dumpstate/dumpstate.cpp

index 6201735..ea70fe5 100644 (file)
@@ -1253,13 +1253,9 @@ bool Dumpstate::FinishZipFile() {
     // TODO: remove once FinishZipFile() is automatically handled by Dumpstate's destructor.
     ds.zip_file.reset(nullptr);
 
-    if (IsUserBuild()) {
-        MYLOGD("Removing temporary file %s\n", tmp_path_.c_str())
-        if (remove(tmp_path_.c_str()) != 0) {
-            ALOGW("remove(%s): %s\n", tmp_path_.c_str(), strerror(errno));
-        }
-    } else {
-        MYLOGD("Keeping temporary file %s on non-user build\n", tmp_path_.c_str())
+    MYLOGD("Removing temporary file %s\n", tmp_path_.c_str())
+    if (remove(tmp_path_.c_str()) != 0) {
+        MYLOGE("Failed to remove temporary file (%s): %s\n", tmp_path_.c_str(), strerror(errno));
     }
 
     return true;