OSDN Git Service

Secure Move: Check to make sure libtruecrypt correctly errored
authorStephen Bird <sbird@cyngn.com>
Fri, 24 Jul 2015 01:42:09 +0000 (18:42 -0700)
committerStephen Bird <sbird@cyngn.com>
Mon, 27 Jul 2015 21:28:25 +0000 (14:28 -0700)
When copying an item out of secure storage and into the regular file system
truecrypt will sometimes report that the file operation failed. When in fact the
operation was a complete success. Add a check to make sure truecrypt is correct.

Change-Id: I1520455a9ce9dc403f2ca6fb50cf1a4f8604bc64

src/com/cyanogenmod/filemanager/commands/secure/MoveCommand.java

index 3cd9748..0a7e09a 100644 (file)
@@ -107,7 +107,12 @@ public class MoveCommand extends Program implements MoveExecutable {
             try {
                 TFile.mv(s, d, SecureConsole.DETECTOR);
             } catch (IOException ex) {
-                throw new ExecutionException("Failed to rename file or directory", ex);
+                // Make sure truecrypt was right
+                // There's a strange bug in it where it thinks that a file did not
+                // move over. However, it actually did.
+                if (!d.exists()) {
+                    throw new ExecutionException("Failed to rename file or directory", ex);
+                }
             }
         }