VirtualBox

Ignore:
Timestamp:
Dec 14, 2011 2:19:55 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
75392
Message:

IPRT/*: add _NO_SYMLINKS flags to certain functions

Location:
trunk/src/VBox/HostServices/SharedFolders
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp

    r39543 r39612  
    125125static RTFMODE testRTDirCreateMode;
    126126
    127 extern int testRTDirCreate(const char *pszPath, RTFMODE fMode)
     127extern int testRTDirCreate(const char *pszPath, RTFMODE fMode, uint32_t fCreate)
    128128{
    129129 /* RTPrintf("%s: pszPath=%s, fMode=0x%llx\n", __PRETTY_FUNCTION__, pszPath,
     
    389389}
    390390
    391 extern int testRTSymlinkDelete(const char *pszSymlink) { RTPrintf("%s\n", __PRETTY_FUNCTION__); return 0; }
     391extern int testRTSymlinkDelete(const char *pszSymlink, uint32_t fDelete)
     392{ RTPrintf("%s\n", __PRETTY_FUNCTION__); return 0; }
    392393extern int testRTSymlinkRead(const char *pszSymlink, char *pszTarget,
    393                               size_t cbTarget) { RTPrintf("%s\n", __PRETTY_FUNCTION__); return 0; }
     394                              size_t cbTarget, uint32_t fRead)
     395{ RTPrintf("%s\n", __PRETTY_FUNCTION__); return 0; }
    394396
    395397/******************************************************************************
  • trunk/src/VBox/HostServices/SharedFolders/teststubs.h

    r39542 r39612  
    3030extern int testRTDirClose(PRTDIR pDir);
    3131#define RTDirCreate          testRTDirCreate
    32 extern int testRTDirCreate(const char *pszPath, RTFMODE fMode);
     32extern int testRTDirCreate(const char *pszPath, RTFMODE fMode, uint32_t fCreate);
    3333#define RTDirOpen            testRTDirOpen
    3434extern int testRTDirOpen(PRTDIR *ppDir, const char *pszPath);
     
    7676extern int testRTPathQueryInfoEx(const char *pszPath, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags);
    7777#define RTSymlinkDelete      testRTSymlinkDelete
    78 extern int testRTSymlinkDelete(const char *pszSymlink);
     78extern int testRTSymlinkDelete(const char *pszSymlink, uint32_t fDelete);
    7979#define RTSymlinkRead        testRTSymlinkRead
    80 extern int testRTSymlinkRead(const char *pszSymlink, char *pszTarget, size_t cbTarget);
     80extern int testRTSymlinkRead(const char *pszSymlink, char *pszTarget, size_t cbTarget, uint32_t fRead);
    8181
    8282#endif /* __VBSF_TEST_STUBS__H */
  • trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp

    r39607 r39612  
    139139    strcat(pDirEntry->szName, szWildCard);
    140140
    141     rc = RTDirOpenFiltered(&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT);
     141    rc = RTDirOpenFiltered(&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT, RTDIROPENFILTERED_FLAGS_NO_SYMLINKS);
    142142    *(pszStartComponent-1) = RTPATH_DELIMITER;
    143143    if (RT_FAILURE(rc))
     
    582582static int vbsfConvertFileOpenFlags(unsigned fShflFlags, RTFMODE fMode, SHFLHANDLE handleInitial, uint32_t *pfOpen)
    583583{
    584     uint32_t fOpen = 0;
     584    uint32_t fOpen = RTFILE_O_NO_SYMLINKS;
    585585    int rc = VINF_SUCCESS;
    586586
     
    10111011
    10121012            pParms->Result = SHFL_FILE_CREATED;
    1013             rc = RTDirCreate(pszPath, fMode);
     1013            rc = RTDirCreate(pszPath, fMode, RTDIRCREATE_FLAGS_NO_SYMLINKS);
    10141014            if (RT_FAILURE(rc))
    10151015            {
     
    10311031        {
    10321032            /* Open the directory now */
    1033             rc = RTDirOpen(&pHandle->dir.Handle, pszPath);
     1033            rc = RTDirOpenFiltered(&pHandle->dir.Handle, pszPath,
     1034                                   RTDIRFILTER_NONE, RTDIROPENFILTERED_FLAGS_NO_SYMLINKS);
    10341035            if (RT_SUCCESS(rc))
    10351036            {
     
    15451546            if (RT_SUCCESS(rc))
    15461547            {
    1547                 rc = RTDirOpenFiltered(&pHandle->dir.SearchHandle, pszFullPath, RTDIRFILTER_WINNT);
     1548                rc = RTDirOpenFiltered(&pHandle->dir.SearchHandle, pszFullPath,
     1549                                       RTDIRFILTER_WINNT, RTDIROPENFILTERED_FLAGS_NO_SYMLINKS);
    15481550
    15491551                /* free the path string */
     
    17281730    if (RT_SUCCESS(rc))
    17291731    {
    1730         rc = RTSymlinkRead(pszFullPath, (char *) pBuffer, cbBuffer);
     1732        rc = RTSymlinkRead(pszFullPath, (char *) pBuffer, cbBuffer, RTSYMLINKREAD_FLAGS_NO_SYMLINKS);
    17311733
    17321734        /* free the path string */
     
    18511853#endif
    18521854
    1853             rc = RTFileSetMode((RTFILE)pHandle->file.Handle, fMode);
     1855            rc = RTFileSetMode(pHandle->file.Handle, fMode);
    18541856            if (rc != VINF_SUCCESS)
    18551857            {
     
    21752177        {
    21762178            if (flags & SHFL_REMOVE_SYMLINK)
    2177                 rc = RTSymlinkDelete(pszFullPath);
    2178             else if (flags & SHFL_REMOVE_FILE)
    2179                 rc = RTFileDelete(pszFullPath);
     2179                rc = RTSymlinkDelete(pszFullPath, RTSYMLINKDELETE_FLAGS_NO_SYMLINKS);
    21802180            else
    2181                 rc = RTDirRemove(pszFullPath);
     2181                rc = RTPathUnlink(pszFullPath, RTPATHUNLINK_FLAGS_NO_SYMLINKS);
    21822182        }
    21832183
     
    22412241            if (flags & SHFL_RENAME_FILE)
    22422242            {
    2243                 rc = RTFileMove(pszFullPathSrc, pszFullPathDest, (flags & SHFL_RENAME_REPLACE_IF_EXISTS) ? RTFILEMOVE_FLAGS_REPLACE : 0);
     2243                rc = RTFileMove(pszFullPathSrc, pszFullPathDest,
     2244                                  ((flags & SHFL_RENAME_REPLACE_IF_EXISTS) ? RTFILEMOVE_FLAGS_REPLACE : 0)
     2245                                | RTFILEMOVE_FLAGS_NO_SYMLINKS);
    22442246            }
    22452247            else
    22462248            {
    22472249                /* NT ignores the REPLACE flag and simply return and already exists error. */
    2248                 rc = RTDirRename(pszFullPathSrc, pszFullPathDest, (flags & SHFL_RENAME_REPLACE_IF_EXISTS) ? RTPATHRENAME_FLAGS_REPLACE : 0);
     2250                rc = RTDirRename(pszFullPathSrc, pszFullPathDest,
     2251                                   ((flags & SHFL_RENAME_REPLACE_IF_EXISTS) ? RTPATHRENAME_FLAGS_REPLACE : 0)
     2252                                 | RTPATHRENAME_FLAGS_NO_SYMLINKS);
    22492253            }
    22502254        }
     
    22862290        return rc;
    22872291
    2288     rc = RTSymlinkCreate(pszFullNewPath, (const char *)pOldPath->String.utf8, RTSYMLINKTYPE_UNKNOWN);
     2292    rc = RTSymlinkCreate(pszFullNewPath, (const char *)pOldPath->String.utf8,
     2293                         RTSYMLINKTYPE_UNKNOWN, RTSYMLINKCREATE_FLAGS_NO_SYMLINKS);
    22892294    if (RT_SUCCESS(rc))
    22902295    {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette