VirtualBox

Ignore:
Timestamp:
Jul 10, 2018 3:58:05 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123591
Message:

Guest Control/Main: Cleaned up internal symlink handling for copyTo / copyFrom tasks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r73036 r73037  
    11101110                case FsObjType_Symlink:
    11111111                {
    1112                     if (mSourceSpec.fFollowSymlinks)
     1112                    if (mSourceSpec.Type.Dir.fFollowSymlinks)
    11131113                    {
    11141114                        /** @todo Symlink handling from guest is not imlemented yet.
    11151115                         *        See IGuestSession::symlinkRead(). */
     1116                        LogRel2(("Guest Control: Warning: Symlink support on guest side not available, skipping \"%s\"",
     1117                                 strEntry.c_str()));
    11161118                    }
    11171119                    break;
     
    12191221                            case RTFS_TYPE_SYMLINK:
    12201222                            {
    1221                                 if (mSourceSpec.fFollowSymlinks)
     1223                                if (mSourceSpec.Type.Dir.fFollowSymlinks)
    12221224                                {
    12231225                                    Utf8Str strEntryAbs = strPathAbs + Utf8Str(Entry.szName);
     
    13761378        Utf8Str strDst = mDest;
    13771379
     1380        bool    fFollowSymlinks;
     1381
    13781382        if (itSrc->enmType == FsObjType_Directory)
    13791383        {
     
    13891393                strDst += Utf8StrFmt("%s", RTPathFilenameEx(strSrc.c_str(), mfPathStyle));
    13901394            }
    1391         }
    1392 
    1393         LogFlowFunc(("strSrc=%s, strDst=%s\n", strSrc.c_str(), strDst.c_str()));
     1395
     1396            fFollowSymlinks = itSrc->Type.Dir.fFollowSymlinks;
     1397        }
     1398        else
     1399        {
     1400            fFollowSymlinks = itSrc->Type.File.fCopyFlags & FileCopyFlag_FollowLinks;
     1401        }
     1402
     1403        LogFlowFunc(("strSrc=%s, strDst=%s, fFollowSymlinks=%RTbool\n", strSrc.c_str(), strDst.c_str(), fFollowSymlinks));
    13941404
    13951405        GuestFsObjData srcObjData; int rcGuest;
    1396         rc = mSession->i_fsQueryInfo(strSrc, itSrc->fFollowSymlinks ? TRUE : FALSE,
    1397                                      srcObjData, &rcGuest);
     1406        rc = mSession->i_fsQueryInfo(strSrc, fFollowSymlinks, srcObjData, &rcGuest);
    13981407        if (RT_FAILURE(rc))
    13991408        {
     
    17521761        AssertPtr(pList);
    17531762
    1754         const bool     fFollowSymlinks   = pList->mSourceSpec.fFollowSymlinks;
    1755         const bool     fCopyIntoExisting = pList->mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_CopyIntoExisting;
    1756         const uint32_t fDirMode          = 0700; /** @todo Play safe by default; implement ACLs. */
     1763        bool     fCopyIntoExisting;
     1764        bool     fFollowSymlinks;
     1765        uint32_t fDirMode = 0700; /** @todo Play safe by default; implement ACLs. */
    17571766
    17581767        LogFlowFunc(("List: srcRootAbs=%s, dstRootAbs=%s\n", pList->mSrcRootAbs.c_str(), pList->mDstRootAbs.c_str()));
     
    17611770        if (pList->mSourceSpec.enmType == FsObjType_Directory)
    17621771        {
    1763             rc = directoryCreate(pList->mDstRootAbs.c_str(), DirectoryCreateFlag_None, fDirMode, fFollowSymlinks);
     1772            fCopyIntoExisting = pList->mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_CopyIntoExisting;
     1773            fFollowSymlinks   = pList->mSourceSpec.Type.Dir.fFollowSymlinks;
     1774
     1775            rc = directoryCreate(pList->mDstRootAbs.c_str(), DirectoryCreateFlag_None, fDirMode,
     1776                                 pList->mSourceSpec.Type.Dir.fFollowSymlinks);
    17641777            if (   rc == VWRN_ALREADY_EXISTS
    17651778                && !fCopyIntoExisting)
     
    17681781            }
    17691782        }
     1783        else if (pList->mSourceSpec.enmType == FsObjType_File)
     1784        {
     1785            fCopyIntoExisting = !(pList->mSourceSpec.Type.File.fCopyFlags & FileCopyFlag_NoReplace);
     1786            fFollowSymlinks   = pList->mSourceSpec.Type.File.fCopyFlags & FileCopyFlag_FollowLinks;
     1787        }
     1788        else
     1789            AssertFailed();
    17701790
    17711791        FsEntries::const_iterator itEntry = pList->mVecEntries.begin();
     
    18041824                    LogFlowFunc(("File '%s': %s -> %s\n", pEntry->strPath.c_str(), strSrcAbs.c_str(), strDstAbs.c_str()));
    18051825                    if (!pList->mSourceSpec.fDryRun)
    1806                         rc = fileCopyToGuest(strSrcAbs, strDstAbs, FileCopyFlag_None);
     1826                        rc = fileCopyToGuest(strSrcAbs, strDstAbs, pList->mSourceSpec.Type.File.fCopyFlags);
    18071827                    break;
    18081828
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