VirtualBox

Changeset 58258 in vbox for trunk/src


Ignore:
Timestamp:
Oct 15, 2015 10:21:38 AM (9 years ago)
Author:
vboxsync
Message:

Storage/RAW: fix conversion to raw (it previously overwrote the converted data with zeroes due to accidentally removed offAccess updating)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/RAW.cpp

    r58132 r58258  
    639639    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
    640640
     641    /* For sequential access do not allow to go back. */
     642    if (   pImage->uOpenFlags & VD_OPEN_FLAGS_SEQUENTIAL
     643        && uOffset < pImage->offAccess)
     644    {
     645        *pcbActuallyRead = 0;
     646        return VERR_INVALID_PARAMETER;
     647    }
     648
    641649    rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, uOffset,
    642650                               pIoCtx, cbRead);
    643651    if (RT_SUCCESS(rc))
     652    {
    644653        *pcbActuallyRead = cbRead;
     654        pImage->offAccess = uOffset + cbRead;
     655    }
    645656
    646657    return rc;
     
    655666    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
    656667
     668    /* For sequential access do not allow to go back. */
     669    if (   pImage->uOpenFlags & VD_OPEN_FLAGS_SEQUENTIAL
     670        && uOffset < pImage->offAccess)
     671    {
     672        *pcbWriteProcess = 0;
     673        *pcbPostRead = 0;
     674        *pcbPreRead  = 0;
     675        return VERR_INVALID_PARAMETER;
     676    }
     677
    657678    rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, uOffset,
    658679                                pIoCtx, cbWrite, NULL, NULL);
     
    662683        *pcbPostRead = 0;
    663684        *pcbPreRead  = 0;
     685        pImage->offAccess = uOffset + cbWrite;
    664686    }
    665687
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette