Index: /trunk/src/VBox/Storage/VDI.cpp
===================================================================
--- /trunk/src/VBox/Storage/VDI.cpp	(revision 68786)
+++ /trunk/src/VBox/Storage/VDI.cpp	(revision 68787)
@@ -244,5 +244,9 @@
 
         if (fDelete && pImage->pszFilename)
-            vdIfIoIntFileDelete(pImage->pIfIo, pImage->pszFilename);
+        {
+            int rc2 = vdIfIoIntFileDelete(pImage->pIfIo, pImage->pszFilename);
+            if (RT_SUCCESS(rc))
+                rc = rc2;
+        }
     }
 
Index: /trunk/src/VBox/Storage/VHD.cpp
===================================================================
--- /trunk/src/VBox/Storage/VHD.cpp	(revision 68786)
+++ /trunk/src/VBox/Storage/VHD.cpp	(revision 68787)
@@ -588,5 +588,9 @@
 
         if (fDelete && pImage->pszFilename)
-            vdIfIoIntFileDelete(pImage->pIfIo, pImage->pszFilename);
+        {
+            int rc2 = vdIfIoIntFileDelete(pImage->pIfIo, pImage->pszFilename);
+            if (RT_SUCCESS(rc))
+                rc = rc2;
+        }
     }
 
Index: /trunk/src/VBox/Storage/VMDK.cpp
===================================================================
--- /trunk/src/VBox/Storage/VMDK.cpp	(revision 68786)
+++ /trunk/src/VBox/Storage/VMDK.cpp	(revision 68787)
@@ -637,6 +637,10 @@
 
         rc = vdIfIoIntFileClose(pImage->pIfIo, pVmdkFile->pStorage);
-        if (RT_SUCCESS(rc) && pVmdkFile->fDelete)
-            rc = vdIfIoIntFileDelete(pImage->pIfIo, pVmdkFile->pszFilename);
+        if (pVmdkFile->fDelete)
+        {
+            int rc2 = vdIfIoIntFileDelete(pImage->pIfIo, pVmdkFile->pszFilename);
+            if (RT_SUCCESS(rc))
+                rc = rc2;
+        }
         RTStrFree((char *)(void *)pVmdkFile->pszFilename);
         RTMemFree(pVmdkFile);
@@ -3261,5 +3265,5 @@
     else
     {
-        vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: error reading the magic number in '%s'"), pImage->pszFilename);   
+        vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: error reading the magic number in '%s'"), pImage->pszFilename);
         rc = VERR_VD_VMDK_INVALID_HEADER;
     }
