VirtualBox

Changeset 52842 in vbox


Ignore:
Timestamp:
Sep 24, 2014 1:44:42 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
96253
Message:

VBoxManageGuestCtrl.cpp: Fixed ctrlCopyCreateSourceRoot().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp

    r51628 r52842  
    23602360
    23612361    char *pszNewRoot = RTStrDup(pszSource);
    2362     AssertPtrReturn(pszNewRoot, VERR_NO_MEMORY);
     2362    if (!pszNewRoot)
     2363        return VERR_NO_MEMORY;
    23632364
    23642365    size_t lenRoot = strlen(pszNewRoot);
    23652366    if (   lenRoot
    2366         && pszNewRoot[lenRoot - 1] == '/'
    2367         && pszNewRoot[lenRoot - 1] == '\\'
    2368         && lenRoot > 1
    2369         && pszNewRoot[lenRoot - 2] == '/'
    2370         && pszNewRoot[lenRoot - 2] == '\\')
    2371     {
    2372         *ppszSourceRoot = pszNewRoot;
    2373         if (lenRoot > 1)
    2374             *ppszSourceRoot[lenRoot - 2] = '\0';
    2375         *ppszSourceRoot[lenRoot - 1] = '\0';
    2376     }
    2377     else
     2367        && (   pszNewRoot[lenRoot - 1] == '/'
     2368            || pszNewRoot[lenRoot - 1] == '\\')
     2369       )
     2370    {
     2371        pszNewRoot[lenRoot - 1] = '\0';
     2372    }
     2373
     2374    if (   lenRoot > 1
     2375        && (   pszNewRoot[lenRoot - 2] == '/'
     2376            || pszNewRoot[lenRoot - 2] == '\\')
     2377       )
     2378    {
     2379        pszNewRoot[lenRoot - 2] = '\0';
     2380    }
     2381
     2382    if (!lenRoot)
    23782383    {
    23792384        /* If there's anything (like a file name or a filter),
    23802385         * strip it! */
    23812386        RTPathStripFilename(pszNewRoot);
    2382         *ppszSourceRoot = pszNewRoot;
    2383     }
     2387    }
     2388
     2389    *ppszSourceRoot = pszNewRoot;
    23842390
    23852391    return VINF_SUCCESS;
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