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

Commit 596ef980 authored by Alex Buynytskyy's avatar Alex Buynytskyy Committed by Automerger Merge Worker
Browse files

Merge "Retry the dir deletion if can't rename." am: d2ed995e am: d536f300...

Merge "Retry the dir deletion if can't rename." am: d2ed995e am: d536f300 am: db0b76fa am: fd918caf

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2047963



Change-Id: I1c7a30c1946e8ba255698f28b1f3b4f875b33055
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents be58cd3b fd918caf
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -707,16 +707,16 @@ static int rename_delete_dir_contents(const std::string& pathname,
    auto temp_dir_path =
            base::StringPrintf("%s/%s", Dirname(pathname).c_str(), temp_dir_name.c_str());

    if (::rename(pathname.c_str(), temp_dir_path.c_str())) {
    auto dir_to_delete = temp_dir_path.c_str();
    if (::rename(pathname.c_str(), dir_to_delete)) {
        if (ignore_if_missing && (errno == ENOENT)) {
            return 0;
        }
        ALOGE("Couldn't rename %s -> %s: %s \n", pathname.c_str(), temp_dir_path.c_str(),
              strerror(errno));
        return -errno;
        ALOGE("Couldn't rename %s -> %s: %s \n", pathname.c_str(), dir_to_delete, strerror(errno));
        dir_to_delete = pathname.c_str();
    }

    return delete_dir_contents(temp_dir_path.c_str(), 1, exclusion_predicate, ignore_if_missing);
    return delete_dir_contents(dir_to_delete, 1, exclusion_predicate, ignore_if_missing);
}

bool is_renamed_deleted_dir(const std::string& path) {