commit | 49090c9d19ef33609e1d20d5cb540be0e6c0b751 | [log] [tgz] |
---|---|---|
author | Ryo Hashimoto <hashimoto@google.com> | Mon Apr 20 22:45:59 2020 +0900 |
committer | Commit Bot <commit-bot@chromium.org> | Fri May 01 18:16:12 2020 +0000 |
tree | 7139880cd46157603d4de1f6a072b5e1f8aef28e | |
parent | a6b19a8593897a2be55fa51de87358e08e965099 [diff] |
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) {