Changeset 46613 in vbox for trunk/src/VBox/Storage/VDI.cpp
- Timestamp:
- Jun 18, 2013 10:27:13 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VDI.cpp
r46612 r46613 225 225 vdiFlushImage(pImage); 226 226 227 vdIfIoIntFileClose(pImage->pIfIo, pImage->pStorage);227 rc = vdIfIoIntFileClose(pImage->pIfIo, pImage->pStorage); 228 228 pImage->pStorage = NULL; 229 229 } … … 1506 1506 1507 1507 /* Close the image. */ 1508 vdiFreeImage(pImage, false); 1509 1510 /* Rename the file. */ 1511 rc = vdIfIoIntFileMove(pImage->pIfIo, pImage->pszFilename, pszFilename, 0); 1512 if (RT_FAILURE(rc)) 1513 { 1514 /* The move failed, try to reopen the original image. */ 1515 int rc2 = vdiOpenImage(pImage, pImage->uOpenFlags); 1516 if (RT_FAILURE(rc2)) 1517 rc = rc2; 1518 1519 goto out; 1520 } 1521 1522 /* Update pImage with the new information. */ 1523 pImage->pszFilename = pszFilename; 1524 1525 /* Open the new image. */ 1526 rc = vdiOpenImage(pImage, pImage->uOpenFlags); 1527 if (RT_FAILURE(rc)) 1528 goto out; 1508 rc = vdiFreeImage(pImage, false); 1509 if (RT_SUCCESS(rc)) 1510 { 1511 /* Rename the file. */ 1512 rc = vdIfIoIntFileMove(pImage->pIfIo, pImage->pszFilename, pszFilename, 0); 1513 if (RT_FAILURE(rc)) 1514 { 1515 /* The move failed, try to reopen the original image. */ 1516 int rc2 = vdiOpenImage(pImage, pImage->uOpenFlags); 1517 if (RT_FAILURE(rc2)) 1518 rc = rc2; 1519 1520 goto out; 1521 } 1522 1523 /* Update pImage with the new information. */ 1524 pImage->pszFilename = pszFilename; 1525 1526 /* Open the new image. */ 1527 rc = vdiOpenImage(pImage, pImage->uOpenFlags); 1528 if (RT_FAILURE(rc)) 1529 goto out; 1530 } 1529 1531 1530 1532 out: … … 3165 3167 3166 3168 if (pStorage) 3167 vdIfIoIntFileClose(pIfIo, pStorage); 3169 { 3170 int rc2 = vdIfIoIntFileClose(pIfIo, pStorage); 3171 if (RT_SUCCESS(rc)) 3172 rc = rc2; /* Propagate error code only if repairing was successful. */ 3173 } 3168 3174 3169 3175 LogFlowFunc(("returns %Rrc\n", rc));
Note:
See TracChangeset
for help on using the changeset viewer.