Changeset 67599 in vbox for trunk/src/VBox/Storage
- Timestamp:
- Jun 26, 2017 9:18:19 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VISO.cpp
r67465 r67599 239 239 * This also updates cbImage and the Uuid members. 240 240 * 241 * @returns 242 * @param pThis .241 * @returns VBox status code. 242 * @param pThis The VISO image instance. 243 243 */ 244 244 static int visoOpenWorker(PVISOIMAGE pThis) … … 285 285 { 286 286 /* 287 * Convert it into an argument vector. 288 * Free the content afterwards to reduce memory pressure. 287 * Make sure it's valid UTF-8 before letting 289 288 */ 290 uint32_t fGetOpt = strncmp(pszReadDst, RT_STR_TUPLE("--iprt-iso-maker-file-marker-ms")) != 0 291 ? RTGETOPTARGV_CNV_QUOTE_BOURNE_SH : RTGETOPTARGV_CNV_QUOTE_MS_CRT; 292 char **papszArgs; 293 int cArgs; 294 rc = RTGetOptArgvFromString(&papszArgs, &cArgs, pszContent, fGetOpt, NULL); 295 296 RTMemTmpFree(pszContent); 297 pszContent = NULL; 298 289 rc = RTStrValidateEncodingEx(pszContent, sizeof(s_szCmdPrefix) + cbFile, 290 RTSTR_VALIDATE_ENCODING_EXACT_LENGTH 291 | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED); 299 292 if (RT_SUCCESS(rc)) 300 293 { 301 294 /* 302 * Try instantiate the ISO image maker.303 * Free the argument vector afterwardto reduce memory pressure.295 * Convert it into an argument vector. 296 * Free the content afterwards to reduce memory pressure. 304 297 */ 305 RTVFSFILE hVfsFile;306 RTERRINFOSTATIC ErrInfo;307 rc = RTFsIsoMakerCmdEx(cArgs, papszArgs, &hVfsFile, RTErrInfoInitStatic(&ErrInfo));308 309 RTGetOptArgvFree(papszArgs);310 papszArgs = NULL;298 uint32_t fGetOpt = strncmp(pszReadDst, RT_STR_TUPLE("--iprt-iso-maker-file-marker-ms")) != 0 299 ? RTGETOPTARGV_CNV_QUOTE_BOURNE_SH : RTGETOPTARGV_CNV_QUOTE_MS_CRT; 300 fGetOpt |= RTGETOPTARGV_CNV_MODIFY_INPUT; 301 char **papszArgs; 302 int cArgs; 303 rc = RTGetOptArgvFromString(&papszArgs, &cArgs, pszContent, fGetOpt, NULL); 311 304 312 305 if (RT_SUCCESS(rc)) 313 306 { 314 uint64_t cbImage; 315 rc = RTVfsFileGetSize(hVfsFile, &cbImage); 307 /* 308 * Try instantiate the ISO image maker. 309 * Free the argument vector afterward to reduce memory pressure. 310 */ 311 RTVFSFILE hVfsFile; 312 RTERRINFOSTATIC ErrInfo; 313 rc = RTFsIsoMakerCmdEx(cArgs, papszArgs, &hVfsFile, RTErrInfoInitStatic(&ErrInfo)); 314 315 RTGetOptArgvFreeEx(papszArgs, fGetOpt); 316 papszArgs = NULL; 317 316 318 if (RT_SUCCESS(rc)) 317 319 { 318 /* 319 * Update the state. 320 */ 321 pThis->cbImage = cbImage; 322 pThis->RegionList.aRegions[0].cRegionBlocksOrBytes = cbImage; 323 324 pThis->hIsoFile = hVfsFile; 325 hVfsFile = NIL_RTVFSFILE; 326 327 rc = VINF_SUCCESS; 320 uint64_t cbImage; 321 rc = RTVfsFileGetSize(hVfsFile, &cbImage); 322 if (RT_SUCCESS(rc)) 323 { 324 /* 325 * Update the state. 326 */ 327 pThis->cbImage = cbImage; 328 pThis->RegionList.aRegions[0].cRegionBlocksOrBytes = cbImage; 329 330 pThis->hIsoFile = hVfsFile; 331 hVfsFile = NIL_RTVFSFILE; 332 333 rc = VINF_SUCCESS; 334 } 335 336 RTVfsFileRelease(hVfsFile); 328 337 } 329 330 RTVfsFileRelease(hVfsFile); 331 } 332 else 333 { 334 /** @todo better error reporting! */ 335 if (RTErrInfoIsSet(&ErrInfo.Core)) 338 else if (RTErrInfoIsSet(&ErrInfo.Core)) 339 { 336 340 LogRel(("visoOpenWorker: RTFsIsoMakerCmdEx failed: %Rrc - %s\n", rc, ErrInfo.Core.pszMsg)); 341 vdIfError(pThis->pIfError, rc, RT_SRC_POS, "VISO: %s", ErrInfo.Core.pszMsg); 342 } 337 343 else 344 { 338 345 LogRel(("visoOpenWorker: RTFsIsoMakerCmdEx failed: %Rrc\n", rc)); 346 vdIfError(pThis->pIfError, rc, RT_SRC_POS, "VISO: RTFsIsoMakerCmdEx failed: %Rrc", rc); 347 } 339 348 } 340 349 } 350 else 351 vdIfError(pThis->pIfError, rc, RT_SRC_POS, "VISO: Invalid file encoding"); 341 352 } 342 353 }
Note:
See TracChangeset
for help on using the changeset viewer.