VirtualBox

Changeset 68787 in vbox


Ignore:
Timestamp:
Sep 19, 2017 8:53:40 AM (7 years ago)
Author:
vboxsync
Message:

Storage/VDI+VHD+VMDK: Preserve the error code (instead of ignoring) when deleting the image failed. It's confusing to report success but still have the file in place.

Location:
trunk/src/VBox/Storage
Files:
3 edited

Legend:

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

    r66505 r68787  
    244244
    245245        if (fDelete && pImage->pszFilename)
    246             vdIfIoIntFileDelete(pImage->pIfIo, pImage->pszFilename);
     246        {
     247            int rc2 = vdIfIoIntFileDelete(pImage->pIfIo, pImage->pszFilename);
     248            if (RT_SUCCESS(rc))
     249                rc = rc2;
     250        }
    247251    }
    248252
  • trunk/src/VBox/Storage/VHD.cpp

    r66486 r68787  
    588588
    589589        if (fDelete && pImage->pszFilename)
    590             vdIfIoIntFileDelete(pImage->pIfIo, pImage->pszFilename);
     590        {
     591            int rc2 = vdIfIoIntFileDelete(pImage->pIfIo, pImage->pszFilename);
     592            if (RT_SUCCESS(rc))
     593                rc = rc2;
     594        }
    591595    }
    592596
  • trunk/src/VBox/Storage/VMDK.cpp

    r67744 r68787  
    637637
    638638        rc = vdIfIoIntFileClose(pImage->pIfIo, pVmdkFile->pStorage);
    639         if (RT_SUCCESS(rc) && pVmdkFile->fDelete)
    640             rc = vdIfIoIntFileDelete(pImage->pIfIo, pVmdkFile->pszFilename);
     639        if (pVmdkFile->fDelete)
     640        {
     641            int rc2 = vdIfIoIntFileDelete(pImage->pIfIo, pVmdkFile->pszFilename);
     642            if (RT_SUCCESS(rc))
     643                rc = rc2;
     644        }
    641645        RTStrFree((char *)(void *)pVmdkFile->pszFilename);
    642646        RTMemFree(pVmdkFile);
     
    32613265    else
    32623266    {
    3263         vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: error reading the magic number in '%s'"), pImage->pszFilename);   
     3267        vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: error reading the magic number in '%s'"), pImage->pszFilename);
    32643268        rc = VERR_VD_VMDK_INVALID_HEADER;
    32653269    }
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