Changeset 84141 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- May 4, 2020 9:15:30 PM (5 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r84031 r84141 507 507 HRESULT Appliance::getManifest(com::Utf8Str &aManifest, com::Utf8Str &aManifestName) 508 508 { 509 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 510 511 aManifest = m->strManifest; 509 /* Write lock the appliance here as we don't want concurrent hMemFileTheirManifest 510 accesses (lazyness/paranoia). */ 511 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 512 513 Assert(aManifest.isEmpty()); 514 if (m->hMemFileTheirManifest != NIL_RTVFSFILE) 515 { 516 uint64_t cchManifest = 0; 517 int rc = RTVfsFileQuerySize(m->hMemFileTheirManifest, &cchManifest); 518 AssertRCReturn(rc, setErrorVrc(rc)); 519 520 rc = aManifest.reserveNoThrow(cchManifest + 1); 521 AssertRCReturn(rc, setErrorVrc(rc)); 522 523 char *pszManifest = aManifest.mutableRaw(); 524 rc = RTVfsFileReadAt(m->hMemFileTheirManifest, 0, pszManifest, cchManifest, NULL); 525 pszManifest[cchManifest] = '\0'; 526 AssertRCReturn(rc, setErrorVrc(rc)); 527 RTStrPurgeEncoding(pszManifest); 528 aManifest.jolt(); 529 } 530 512 531 aManifestName = m->strManifestName; 513 532 return S_OK; -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r84031 r84141 2561 2561 * reference is always consumed. 2562 2562 * @param pszSubFileNm The manifest filename (no path) for error 2563 * messages and logging.2563 * messages, logging and strManifestName. 2564 2564 * @returns COM status code, error info set. 2565 2565 * @throws Nothing … … 2570 2570 2571 2571 /* Remember the manifet file name */ 2572 m->strManifestName.assign(pszSubFileNm); 2572 HRESULT hrc = m->strManifestName.assignEx(pszSubFileNm); 2573 AssertReturn(SUCCEEDED(hrc), hrc); 2573 2574 2574 2575 /* … … 2583 2584 2584 2585 /* 2585 * Store the manifest as a string in the m->strManifest2586 */2587 {2588 char abBuf[_16K];2589 size_t cbRead;2590 2591 vrc = RTVfsFileRead(m->hMemFileTheirManifest, &abBuf, sizeof(abBuf), &cbRead);2592 if (RT_SUCCESS(vrc))2593 m->strManifest.assignEx((const char*)abBuf, cbRead);2594 2595 /* Rewind to the beginning, because the manifest will be read later again */2596 RTVfsFileSeek(m->hMemFileTheirManifest, 0, RTFILE_SEEK_BEGIN, NULL);2597 }2598 2599 /*2600 2586 * Parse the manifest. 2601 2587 */ … … 2609 2595 RTVfsIoStrmRelease(hVfsIos); 2610 2596 if (RT_FAILURE(vrc)) 2611 throwsetErrorVrc(vrc, tr("Failed to parse manifest file '%s' for '%s' (%Rrc): %s"),2612 pszSubFileNm, pTask->locInfo.strPath.c_str(), vrc, szErr);2597 return setErrorVrc(vrc, tr("Failed to parse manifest file '%s' for '%s' (%Rrc): %s"), 2598 pszSubFileNm, pTask->locInfo.strPath.c_str(), vrc, szErr); 2613 2599 2614 2600 /*
Note:
See TracChangeset
for help on using the changeset viewer.