Changeset 78703 in vbox
- Timestamp:
- May 24, 2019 12:23:13 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 130781
- Location:
- trunk/src/VBox/HostServices/SharedFolders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/shfl.h
r78698 r78703 66 66 typedef SHFLCLIENTDATA *PSHFLCLIENTDATA; 67 67 68 69 /** @def SHFL_CLIENT_NEED_WINDOWS_ERROR_STYLE_ADJUST 70 * Whether to make windows error style adjustments on a posix host. 71 * This always returns false on windows hosts. */ 72 #ifdef RT_OS_WINDOWS 73 # define SHFL_CLIENT_NEED_WINDOWS_ERROR_STYLE_ADJUST_ON_POSIX(a_pClient) (false) 74 #else 75 # define SHFL_CLIENT_NEED_WINDOWS_ERROR_STYLE_ADJUST_ON_POSIX(a_pClient) ((a_pClient)->enmErrorStyle == kShflErrorStyle_Windows) 76 #endif 77 68 78 #endif /* !VBOX_INCLUDED_SRC_SharedFolders_shfl_h */ 69 79 -
trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
r78467 r78703 56 56 *********************************************************************************************************************************/ 57 57 #define SHFL_RT_LINK(pClient) ((pClient)->fu32Flags & SHFL_CF_SYMLINKS ? RTPATH_F_ON_LINK : RTPATH_F_FOLLOW_LINK) 58 59 60 #ifndef RT_OS_WINDOWS 61 /** 62 * Helps to check if pszPath deserves a VERR_PATH_NOT_FOUND status when catering 63 * to windows guests. 64 */ 65 static bool vbsfErrorStyleIsWindowsPathNotFound(char *pszPath) 66 { 67 /* 68 * Check if the parent directory actually exists. We temporarily modify the path here. 69 */ 70 size_t cchParent = RTPathParentLength(pszPath); 71 char chSaved = pszPath[cchParent]; 72 pszPath[cchParent] = '\0'; 73 RTFSOBJINFO ObjInfo; 74 int vrc = RTPathQueryInfoEx(pszPath, &ObjInfo, RTFSOBJATTRADD_NOTHING, RTPATH_F_FOLLOW_LINK); 75 pszPath[cchParent] = chSaved; 76 if (RT_SUCCESS(vrc)) 77 { 78 if (RTFS_IS_DIRECTORY(ObjInfo.Attr.fMode)) 79 return false; 80 return true; 81 } 82 if (vrc == VERR_FILE_NOT_FOUND || vrc == VERR_PATH_NOT_FOUND) 83 return true; 84 return false; 85 } 86 #endif /* RT_OS_WINDOWS */ 58 87 59 88 … … 451 480 * @retval pParms @a Info On success the parameters of the file opened or created 452 481 */ 453 static int vbsfOpenFile(SHFLCLIENTDATA *pClient, SHFLROOT root, c onst char *pszPath, SHFLCREATEPARMS *pParms)482 static int vbsfOpenFile(SHFLCLIENTDATA *pClient, SHFLROOT root, char *pszPath, SHFLCREATEPARMS *pParms) 454 483 { 455 484 LogFlow(("vbsfOpenFile: pszPath = %s, pParms = %p\n", pszPath, pParms)); … … 490 519 case VERR_FILE_NOT_FOUND: 491 520 pParms->Result = SHFL_FILE_NOT_FOUND; 492 521 #ifndef RT_OS_WINDOWS 522 if ( SHFL_CLIENT_NEED_WINDOWS_ERROR_STYLE_ADJUST_ON_POSIX(pClient) 523 && vbsfErrorStyleIsWindowsPathNotFound(pszPath)) 524 pParms->Result = SHFL_PATH_NOT_FOUND; 525 #endif 493 526 /* This actually isn't an error, so correct the rc before return later, 494 527 because the driver (VBoxSF.sys) expects rc = VINF_SUCCESS and checks the result code. */ … … 645 678 * @note folders are created with fMode = 0777 646 679 */ 647 static int vbsfOpenDir(SHFLCLIENTDATA *pClient, SHFLROOT root, c onst char *pszPath,680 static int vbsfOpenDir(SHFLCLIENTDATA *pClient, SHFLROOT root, char *pszPath, 648 681 SHFLCREATEPARMS *pParms) 649 682 { … … 705 738 else 706 739 { 740 /** @todo we still return 'rc' as failure here, so this is mostly pointless. */ 707 741 switch (rc) 708 742 { 709 743 case VERR_FILE_NOT_FOUND: /* Does this make sense? */ 710 744 pParms->Result = SHFL_FILE_NOT_FOUND; 745 #ifndef RT_OS_WINDOWS 746 if ( SHFL_CLIENT_NEED_WINDOWS_ERROR_STYLE_ADJUST_ON_POSIX(pClient) 747 && vbsfErrorStyleIsWindowsPathNotFound(pszPath)) 748 { 749 pParms->Result = SHFL_PATH_NOT_FOUND; 750 rc = VERR_PATH_NOT_FOUND; 751 } 752 #endif 711 753 break; 712 754 case VERR_PATH_NOT_FOUND:
Note:
See TracChangeset
for help on using the changeset viewer.