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

Commit 44f32fb8 authored by Jerry Zhang's avatar Jerry Zhang Committed by android-build-merger
Browse files

Merge "Perform database moveObject after actual move." am: 8aa2c307 am: 29447aa3

am: ba0a69a6

Change-Id: Idc5064c25a04da5623313e138e616f0298581eae
parents 80bc9936 ba0a69a6
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -1062,10 +1062,6 @@ MtpResponseCode MtpServer::doMoveObject() {
        path += "/";
    path += info.mName;

    result = mDatabase->moveObject(objectHandle, parent, storageID, path);
    if (result != MTP_RESPONSE_OK)
        return result;

    if (info.mStorageID == storageID) {
        ALOGV("Moving file from %s to %s", (const char*)fromPath, (const char*)path);
        if (rename(fromPath, path)) {
@@ -1092,10 +1088,8 @@ MtpResponseCode MtpServer::doMoveObject() {
    }

    // If the move failed, undo the database change
    if (result != MTP_RESPONSE_OK)
        if (mDatabase->moveObject(objectHandle, info.mParent, info.mStorageID,
                    fromPath) != MTP_RESPONSE_OK)
            ALOGE("Couldn't undo failed move");
    if (result == MTP_RESPONSE_OK)
        result = mDatabase->moveObject(objectHandle, parent, storageID, path);

    return result;
}