Failing to \\"Migrate data\\" leaves target unusable am: 77f156d9f0
am: 1bc5ab0c4d

Change-Id: I1b93a87bb03039c627a9e057a1d1b56a2304da9e
diff --git a/MoveTask.cpp b/MoveTask.cpp
index f5cf04c..0a60c4e 100644
--- a/MoveTask.cpp
+++ b/MoveTask.cpp
@@ -198,7 +198,7 @@
 
     // Step 3: perform actual copy
     if (execCp(fromPath, toPath, 20, 60) != OK) {
-        goto fail;
+        goto copy_fail;
     }
 
     // NOTE: MountService watches for this magic value to know
@@ -218,6 +218,12 @@
     notifyProgress(kMoveSucceeded);
     release_wake_lock(kWakeLock);
     return;
+
+copy_fail:
+    // if we failed to copy the data we should not leave it laying around
+    // in target location. Do not check return value, we can not do any
+    // useful anyway.
+    execRm(toPath, 80, 1);
 fail:
     {
         std::lock_guard<std::mutex> lock(VolumeManager::Instance()->getLock());