Changeset 86241 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Sep 23, 2020 2:31:55 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 140510
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostDriveImpl.cpp
r85929 r86241 66 66 m.partitions.clear(); 67 67 68 const char *pszDrivePath = drivePath.c_str();69 70 #ifdef RT_OS_DARWIN71 /*72 * Ensure the path specified for the drive in raw mode, i.e. drive name begins with 'r'73 * Otherwise, the RTFileOpen will always return the error about 'busy resource'74 */75 /** @todo r=bird: Shouldn't we make iokit.cpp just return the /dev/rdiskX*76 * paths instead then? */77 com::Utf8Str strAdjustedDrivePath;78 const char *pszDriveName = RTPathFilename(pszDrivePath);79 if (pszDriveName && *pszDriveName != 'r')80 {81 strAdjustedDrivePath = drivePath.substr(0, (size_t)(pszDriveName - pszDrivePath));82 strAdjustedDrivePath.append('r');83 strAdjustedDrivePath.append(pszDriveName);84 pszDrivePath = strAdjustedDrivePath.c_str();85 }86 #endif87 88 68 /* 89 69 * Try open the drive so we can extract futher details, … … 92 72 HRESULT hrc = E_FAIL; 93 73 RTFILE hRawFile = NIL_RTFILE; 94 int vrc = RTFileOpen(&hRawFile, pszDrivePath, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);74 int vrc = RTFileOpen(&hRawFile, drivePath.c_str(), RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 95 75 if (RT_SUCCESS(vrc)) 96 76 { … … 192 172 } 193 173 else 194 hrc = Global::vboxStatusCodeToCOM(vrc); 174 { 175 /* 176 * We don't use the Global::vboxStatusCodeToCOM(vrc) here 177 * because RTFileOpen can return some error which causes 178 * the assertion and breaks original idea of returning 179 * the object in the limited state. 180 */ 181 if ( vrc == VERR_RESOURCE_BUSY 182 || vrc == VERR_ACCESS_DENIED) 183 hrc = E_ACCESSDENIED; 184 else 185 hrc = VBOX_E_IPRT_ERROR; 186 } 195 187 196 188 /* Confirm a successful initialization */
Note:
See TracChangeset
for help on using the changeset viewer.