VirtualBox

Changeset 100265 in vbox


Ignore:
Timestamp:
Jun 23, 2023 1:50:43 PM (22 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
157980
Message:

Shared Clipboard: Added handling an explicit absolute root path for shClTransferListEntryQueryFsInfo(). bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers-provider-local.cpp

    r100204 r100265  
    317317}
    318318
    319 static int shClTransferListEntryQueryFsInfo(PSHCLLISTENTRY pListEntry, PSHCLFSOBJINFO pFsObjInfo)
    320 {
     319/**
     320 * Queries information about a local list entry.
     321 *
     322 * @returns VBox status code.
     323 * @param   pszPathRootAbs      Absolute root path to use for the entry.
     324 * @param   pListEntry          List entry to query information for.
     325 * @param   pFsObjInfo          Where to store the queried information on success.
     326 */
     327static int shClTransferListEntryQueryFsInfo(const char *pszPathRootAbs, PSHCLLISTENTRY pListEntry, PSHCLFSOBJINFO pFsObjInfo)
     328{
     329    AssertPtrReturn(pszPathRootAbs, VERR_INVALID_POINTER);
    321330    AssertPtrReturn(pListEntry, VERR_INVALID_POINTER);
    322331
    323     const char *pcszSrcPathAbs = pListEntry->pszName;
    324     AssertPtrReturn(pcszSrcPathAbs, VERR_INVALID_POINTER);
    325 
    326     int rc;
    327 
    328     /* Make sure that we only advertise relative source paths, not absolute ones. */
    329     char *pszFileName = RTPathFilename(pcszSrcPathAbs);
    330     if (pszFileName)
    331     {
    332         Assert(pszFileName >= pcszSrcPathAbs);
    333         size_t cchDstBase = pszFileName - pcszSrcPathAbs;
    334         const char *pszDstPath = &pcszSrcPathAbs[cchDstBase];
    335 
    336         LogFlowFunc(("pcszSrcPathAbs=%s, pszDstPath=%s\n", pcszSrcPathAbs, pszDstPath));
    337 
    338         RTFSOBJINFO fsObjInfo;
    339         rc = RTPathQueryInfo(pcszSrcPathAbs, &fsObjInfo, RTFSOBJATTRADD_NOTHING);
    340         if (RT_SUCCESS(rc))
    341             rc = ShClFsObjInfoFromIPRT(pFsObjInfo, &fsObjInfo);
    342     }
    343     else
    344         rc = VERR_INVALID_POINTER;
     332    const char *pszSrcPathAbs = RTPathJoinA(pszPathRootAbs, pListEntry->pszName);
     333    AssertPtrReturn(pszSrcPathAbs, VERR_NO_MEMORY);
     334
     335    RTFSOBJINFO fsObjInfo;
     336    int rc = RTPathQueryInfo(pszSrcPathAbs, &fsObjInfo, RTFSOBJATTRADD_NOTHING);
     337    if (RT_SUCCESS(rc))
     338        rc = ShClFsObjInfoFromIPRT(pFsObjInfo, &fsObjInfo);
    345339
    346340    return rc;
     
    358352    {
    359353        AssertBreakStmt(pEntry->cbInfo == sizeof(SHCLFSOBJINFO), rc = VERR_WRONG_ORDER);
    360         rc = shClTransferListEntryQueryFsInfo(pEntry, (PSHCLFSOBJINFO)pEntry->pvInfo);
     354        rc = shClTransferListEntryQueryFsInfo(pCtx->pTransfer->pszPathRootAbs, pEntry, (PSHCLFSOBJINFO)pEntry->pvInfo);
    361355        if (RT_FAILURE(rc)) /* Currently this is an all-or-nothing op. */
    362356            break;
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