VirtualBox

Ignore:
Timestamp:
Apr 17, 2019 9:36:59 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130107
Message:

IPRT,FsPerf: Added RTDIR_F_NO_ABS_PATH and RTDIRRMREC_F_NO_ABS_PATH to help FsPerf work below PATH_MAX on linux. bugref:9172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/dir.cpp

    r78184 r78186  
    527527     * for querying extra information about the objects we list.
    528528     * As a sideeffect we also validate the path here.
     529     *
     530     * Note! The RTDIR_F_NO_ABS_PATH mess is there purely for allowing us to
     531     *       work around PATH_MAX using CWD on linux and other unixy systems.
    529532     */
    530533    char  *pszAbsPath;
     
    542545
    543546        cbFilter = cucFilter0 = 0;
    544         pszAbsPath = RTPathAbsExDup(NULL, pszPath, RTPATHABS_F_ENSURE_TRAILING_SLASH);
     547        if (!(fFlags & RTDIR_F_NO_ABS_PATH))
     548            pszAbsPath = RTPathAbsExDup(NULL, pszPath, RTPATHABS_F_ENSURE_TRAILING_SLASH);
     549        else
     550        {
     551            size_t cchTmp = strlen(pszPath);
     552            pszAbsPath = RTStrAlloc(cchTmp + 2);
     553            if (pszAbsPath)
     554            {
     555                memcpy(pszAbsPath, pszPath, cchTmp);
     556                pszAbsPath[cchTmp] = RTPATH_SLASH;
     557                pszAbsPath[cchTmp + 1 - fDirSlash] = '\0';
     558            }
     559        }
    545560    }
    546561    else
     
    556571                return VERR_NO_MEMORY;
    557572            pszTmp[pszFilter - pszPath] = '\0';
    558             pszAbsPath = RTPathAbsExDup(NULL, pszTmp, RTPATHABS_F_ENSURE_TRAILING_SLASH);
    559             RTStrFree(pszTmp);
    560         }
     573            if (!(fFlags & RTDIR_F_NO_ABS_PATH))
     574            {
     575                pszAbsPath = RTPathAbsExDup(NULL, pszTmp, RTPATHABS_F_ENSURE_TRAILING_SLASH);
     576                RTStrFree(pszTmp);
     577            }
     578            else
     579            {
     580                pszAbsPath = pszTmp;
     581                RTPathEnsureTrailingSeparator(pszAbsPath, strlen(pszPath) + 1);
     582            }
     583        }
     584        else if (!(fFlags & RTDIR_F_NO_ABS_PATH))
     585            pszAbsPath = RTPathAbsExDup(NULL, ".", RTPATHABS_F_ENSURE_TRAILING_SLASH);
    561586        else
    562             pszAbsPath = RTPathAbsExDup(NULL, ".", RTPATHABS_F_ENSURE_TRAILING_SLASH);
     587            pszAbsPath = RTStrDup("." RTPATH_SLASH_STR);
    563588        fDirSlash = true;
    564589    }
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