VirtualBox

Changeset 97456 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Nov 8, 2022 2:56:27 PM (2 years ago)
Author:
vboxsync
Message:

Guest Control/Main: Fixed returning the correct error code from GuestSession::fsObjRemove() when a guest file can't be accessed. ​bugref:10286

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h

    r97417 r97456  
    824824     * @{ */
    825825    int FromLs(const GuestProcessStreamBlock &strmBlk, bool fLong);
     826    int FromRm(const GuestProcessStreamBlock &strmBlk);
    826827    int FromStat(const GuestProcessStreamBlock &strmBlk);
    827828    int FromMkTemp(const GuestProcessStreamBlock &strmBlk);
  • trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp

    r97446 r97456  
    247247
    248248/**
     249 * Parses stream block output data which came from the 'rm' (vbox_rm)
     250 * VBoxService toolbox command. The result will be stored in this object.
     251 *
     252 * @returns VBox status code.
     253 * @param   strmBlk             Stream block output data to parse.
     254 */
     255int GuestFsObjData::FromRm(const GuestProcessStreamBlock &strmBlk)
     256{
     257#ifdef DEBUG
     258    strmBlk.DumpToLog();
     259#endif
     260    /* Object name. */
     261    mName = strmBlk.GetString("fname");
     262
     263    /* Return the stream block's rc. */
     264    return strmBlk.GetRc();
     265}
     266
     267/**
    249268 * Parses stream block output data which came from the 'stat' (vbox_stat)
    250269 * VBoxService toolbox command. The result will be stored in this object.
     
    405424 *
    406425 * @return  VBox status code.
     426 * @retval  VERR_NOT_FOUND if the return code string ("rc") was not found.
    407427 */
    408428int GuestProcessStreamBlock::GetRc(void) const
     
    413433        return RTStrToInt16(pszValue);
    414434    }
     435    /** @todo We probably should have a dedicated error for that, VERR_GSTCTL_GUEST_TOOLBOX_whatever. */
    415436    return VERR_NOT_FOUND;
    416437}
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r97446 r97456  
    15861586    LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
    15871587
    1588     int vrc = VINF_SUCCESS;
    1589 
    15901588    GuestProcessStartupInfo procInfo;
    15911589    GuestProcessStream      streamOut;
     
    16031601    catch (std::bad_alloc &)
    16041602    {
    1605         vrc = VERR_NO_MEMORY;
    1606     }
    1607 
    1608     if (RT_SUCCESS(vrc))
    1609         vrc = GuestProcessTool::run(this, procInfo, prcGuest);
    1610 
    1611     LogFlowFuncLeaveRC(vrc);
     1603        return VERR_NO_MEMORY;
     1604    }
     1605
     1606    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     1607    GuestCtrlStreamObjects stdOut;
     1608    int vrc = GuestProcessTool::runEx(this, procInfo, &stdOut, 1 /* cStrmOutObjects */, &vrcGuest);
     1609    if (GuestProcess::i_isGuestError(vrc))
     1610    {
     1611        if (!stdOut.empty())
     1612        {
     1613            GuestFsObjData objData;
     1614            vrc = objData.FromRm(stdOut.at(0));
     1615            if (RT_FAILURE(vrc))
     1616            {
     1617                vrcGuest = vrc;
     1618                if (prcGuest)
     1619                    *prcGuest = vrcGuest;
     1620                vrc = VERR_GSTCTL_GUEST_ERROR;
     1621            }
     1622        }
     1623        else
     1624            vrc = VERR_BROKEN_PIPE;
     1625    }
     1626    else if (prcGuest)
     1627        *prcGuest = vrcGuest;
     1628
     1629    LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest));
    16121630    return vrc;
    16131631}
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