Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6908bbb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Use REPLACE_EXISTING for rename(2) workaround." into rvc-dev am: 78243297 am: 88214048

Change-Id: I76d671d12dab8b47cdd41272fcd9c9b0dcd6c3db
parents 69d5987f 88214048
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -201,6 +201,7 @@ import java.lang.reflect.Method;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -7413,8 +7414,10 @@ public final class ActivityThread extends ClientTransactionHandler {
                if (e.errno == OsConstants.EXDEV && oldPath.startsWith("/storage/")) {
                    Log.v(TAG, "Recovering failed rename " + oldPath + " to " + newPath);
                    try {
                        Files.move(new File(oldPath).toPath(), new File(newPath).toPath());
                        Files.move(new File(oldPath).toPath(), new File(newPath).toPath(),
                                StandardCopyOption.REPLACE_EXISTING);
                    } catch (IOException e2) {
                        Log.e(TAG, "Rename recovery failed ", e);
                        throw e;
                    }
                } else {