cryptohome: Call base::ReplaceFile() in Platform::Rename()

base::Move() does more than rename(2).
If the destination is a non-empty directory, it tries to move the source
directory to under the destination directory.
This behavior is surprising and always undesired.

Also, there is Platform::Move() when base::Move() is actually desired.

BUG=chromium:1072253
TEST=Rename cryptohome

Change-Id: Icc42aea75562175cd3940ca860607acaa80c8be6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2156666
Tested-by: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
(cherry picked from commit 6198dc2baaf36427188c0078323ae697b88af9b0)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2166122
Commit-Queue: Jorge Lucangeli Obes <jorgelo@chromium.org>
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
(cherry picked from commit dd4430e6216e0cd721df6d20620ca45757ad2e29)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2173573
diff --git a/cryptohome/platform.cc b/cryptohome/platform.cc
index aad505a..4ae66ff 100644
--- a/cryptohome/platform.cc
+++ b/cryptohome/platform.cc
@@ -904,7 +904,7 @@
 }
 
 bool Platform::Rename(const FilePath& from, const FilePath& to) {
-  return base::Move(from, to);
+  return base::ReplaceFile(from, to, /*error=*/nullptr);
 }
 
 bool Platform::Copy(const FilePath& from, const FilePath& to) {