VirtualBox

Ignore:
Timestamp:
Nov 16, 2017 2:31:25 PM (7 years ago)
Author:
vboxsync
Message:

IPRT: More work on directory relative APIs (NT mainly) and VFS; introducing RTMkDir (test) tool.

  • Added RTVfsDirCreateDir
  • Added RTVfsChainOpenParentDir and RTVfsChainSplitOffFinalPath.
  • Added new tool for testing this called RTMkDir.
  • Fixed directory traversal problem with stddir by making it okay to return VERR_FILE_NOT_FOUND as well.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/generic/dirrel-r3-generic.cpp

    r69705 r69716  
    211211 * @param   fMode           The mode of the new directory.
    212212 * @param   fCreate         Create flags, RTDIRCREATE_FLAGS_XXX.
     213 * @param   phSubDir        Where to return the handle of the created directory.
     214 *                          Optional.
    213215 *
    214216 * @sa      RTDirCreate
    215217 */
    216 RTDECL(int) RTDirRelDirCreate(PRTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fCreate)
    217 {
    218     PRTDIR pThis = hDir;
    219     AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    220     AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
    221 
    222     char szPath[RTPATH_MAX];
    223     int rc = rtDirRelBuildFullPath(pThis, szPath, sizeof(szPath), pszRelPath);
    224     if (RT_SUCCESS(rc))
     218RTDECL(int) RTDirRelDirCreate(PRTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fCreate, PRTDIR *phSubDir)
     219{
     220    PRTDIR pThis = hDir;
     221    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     222    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     223
     224    char szPath[RTPATH_MAX];
     225    int rc = rtDirRelBuildFullPath(pThis, szPath, sizeof(szPath), pszRelPath);
     226    if (RT_SUCCESS(rc))
     227    {
    225228        rc = RTDirCreate(szPath, fMode, fCreate);
     229        if (RT_SUCCESS(rc) && phSubDir)
     230            rc = RTDirOpen(phSubDir, szPath);
     231    }
    226232    return rc;
    227233}
Note: See TracChangeset for help on using the changeset viewer.

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