Changeset 83349 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Mar 20, 2020 1:40:21 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r83286 r83349 325 325 if (RT_SUCCESS(rc)) 326 326 { 327 /* Seeking is optional. However, the whole operation 328 * will fail if we don't succeed seeking to the wanted position. */ 329 if (offOpen) 330 rc = RTFileSeek(pFile->hFile, (int64_t)offOpen, RTFILE_SEEK_BEGIN, NULL /* Current offset */); 327 RTFSOBJINFO objInfo; 328 rc = RTFileQueryInfo(pFile->hFile, &objInfo, RTFSOBJATTRADD_NOTHING); 331 329 if (RT_SUCCESS(rc)) 332 330 { 333 /* 334 * Succeeded! 335 */ 336 uHandle = VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pHostCtx->uContextID); 337 pFile->uHandle = uHandle; 338 pFile->fOpen = fFlags; 339 RTListAppend(&pSession->lstFiles, &pFile->Node); 340 VGSvcVerbose(2, "[File %s] Opened (ID=%RU32)\n", pFile->szName, pFile->uHandle); 331 /* Make sure that we only open stuff we really support. 332 * Only POSIX / UNIX we could open stuff like directories and sockets as well. */ 333 if ( RT_LIKELY(RTFS_IS_FILE(objInfo.Attr.fMode)) 334 || RTFS_IS_SYMLINK(objInfo.Attr.fMode)) 335 { 336 /* Seeking is optional. However, the whole operation 337 * will fail if we don't succeed seeking to the wanted position. */ 338 if (offOpen) 339 rc = RTFileSeek(pFile->hFile, (int64_t)offOpen, RTFILE_SEEK_BEGIN, NULL /* Current offset */); 340 if (RT_SUCCESS(rc)) 341 { 342 /* 343 * Succeeded! 344 */ 345 uHandle = VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pHostCtx->uContextID); 346 pFile->uHandle = uHandle; 347 pFile->fOpen = fFlags; 348 RTListAppend(&pSession->lstFiles, &pFile->Node); 349 VGSvcVerbose(2, "[File %s] Opened (ID=%RU32)\n", pFile->szName, pFile->uHandle); 350 } 351 else 352 VGSvcError("[File %s] Seeking to offset %RU64 failed: rc=%Rrc\n", pFile->szName, offOpen, rc); 353 } 354 else 355 { 356 VGSvcError("[File %s] Unsupported mode %#x\n", pFile->szName, objInfo.Attr.fMode); 357 rc = VERR_NOT_SUPPORTED; 358 } 341 359 } 342 360 else 343 VGSvcError("[File %s] Seeking to offset %RU64 failed: rc=%Rrc\n", pFile->szName, offOpen, rc);361 VGSvcError("[File %s] Getting mode failed with rc=%Rrc\n", pFile->szName, rc); 344 362 } 345 363 else
Note:
See TracChangeset
for help on using the changeset viewer.