VirtualBox

Changeset 70388 in vbox for trunk/src


Ignore:
Timestamp:
Dec 29, 2017 4:51:03 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
119993
Message:

Main/GuestProcessImpl.cpp: Made annoying assertion in GuestProcessTool::i_exitCodeToRc andy-only because he hasn't bothered making sure the testcase avoid this assertion yet.

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

Legend:

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

    r69500 r70388  
    190190    int  guestRc;
    191191    /** The process tool's returned exit code. */
    192     LONG lExitCode;
     192    int32_t iExitCode;
    193193};
    194194
     
    229229    bool i_isRunning(void);
    230230
    231     int i_terminatedOk(LONG *plExitCode = NULL);
     231    int i_terminatedOk(int32_t *piExitCode = NULL);
    232232
    233233    int i_terminate(uint32_t uTimeoutMS, int *pGuestRc);
     
    245245                                GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, GuestProcessToolErrorInfo &errorInfo);
    246246
    247     static int i_exitCodeToRc(const GuestProcessStartupInfo &startupInfo, LONG lExitCode);
    248 
    249     static int i_exitCodeToRc(const char *pszTool, LONG lExitCode);
     247    static int i_exitCodeToRc(const GuestProcessStartupInfo &startupInfo, int32_t iExitCode);
     248
     249    static int i_exitCodeToRc(const char *pszTool, int32_t iExitCode);
    250250
    251251protected:
  • trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp

    r69500 r70388  
    20662066    {
    20672067        if (errorInfo.guestRc == VWRN_GSTCTL_PROCESS_EXIT_CODE)
    2068         {
    2069             guestRc = GuestProcessTool::i_exitCodeToRc(startupInfo, errorInfo.lExitCode);
    2070         }
     2068            guestRc = GuestProcessTool::i_exitCodeToRc(startupInfo, errorInfo.iExitCode);
    20712069        else
    20722070            guestRc = errorInfo.guestRc;
     
    21222120    {
    21232121        if (errorInfo.guestRc == VWRN_GSTCTL_PROCESS_EXIT_CODE)
    2124         {
    2125             guestRc = GuestProcessTool::i_exitCodeToRc(startupInfo, errorInfo.lExitCode);
    2126         }
     2122            guestRc = GuestProcessTool::i_exitCodeToRc(startupInfo, errorInfo.iExitCode);
    21272123        else
    21282124            guestRc = errorInfo.guestRc;
     
    21932189        vrc = procTool.i_wait(GUESTPROCESSTOOL_FLAG_NONE, &errorInfo.guestRc);
    21942190        if (RT_SUCCESS(vrc))
    2195             errorInfo.guestRc = procTool.i_terminatedOk(&errorInfo.lExitCode);
    2196     }
    2197 
    2198     LogFlowFunc(("Returned rc=%Rrc, guestRc=%Rrc, exitCode=%ld\n", vrc, errorInfo.guestRc, errorInfo.lExitCode));
     2191            errorInfo.guestRc = procTool.i_terminatedOk(&errorInfo.iExitCode);
     2192    }
     2193
     2194    LogFlowFunc(("Returned rc=%Rrc, guestRc=%Rrc, iExitCode=%d\n", vrc, errorInfo.guestRc, errorInfo.iExitCode));
    21992195    return vrc;
    22002196}
     
    22072203 *          or VINF_SUCCESS otherwise.
    22082204 *
    2209  * @param   plExitCode      Exit code of the tool. Optional.
     2205 * @param   piExitCode      Exit code of the tool. Optional.
    22102206 */
    2211 int GuestProcessTool::i_terminatedOk(LONG *plExitCode /* = NULL */)
     2207int GuestProcessTool::i_terminatedOk(int32_t *piExitCode /* = NULL */)
    22122208{
    22132209    Assert(!pProcess.isNull());
     
    22172213    if (!i_isRunning())
    22182214    {
    2219         LONG lExitCode = -1;
    2220         HRESULT hr = pProcess->COMGETTER(ExitCode(&lExitCode));
     2215        LONG iExitCode = -1;
     2216        HRESULT hr = pProcess->COMGETTER(ExitCode(&iExitCode));
    22212217        AssertComRC(hr);
    22222218
    2223         if (plExitCode)
    2224             *plExitCode = lExitCode;
    2225 
    2226         vrc = (lExitCode != 0)
    2227             ? VWRN_GSTCTL_PROCESS_EXIT_CODE : VINF_SUCCESS;
     2219        if (piExitCode)
     2220            *piExitCode = iExitCode;
     2221
     2222        vrc = iExitCode != 0 ? VWRN_GSTCTL_PROCESS_EXIT_CODE : VINF_SUCCESS;
    22282223    }
    22292224    else
     
    22412236int GuestProcessTool::i_waitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkOut, int *pGuestRc)
    22422237{
    2243     LogFlowThisFunc(("fFlags=0x%x, pStreamBlock=%p, pGuestRc=%p\n",
    2244                      fFlags, pStrmBlkOut, pGuestRc));
     2238    LogFlowThisFunc(("fFlags=0x%x, pStreamBlock=%p, pGuestRc=%p\n", fFlags, pStrmBlkOut, pGuestRc));
    22452239
    22462240    /* Can we parse the next block without waiting? */
     
    24482442 * Converts a toolbox tool's exit code to an IPRT error code.
    24492443 *
    2450  * @return  int             Returned IPRT error for the particular tool.
    2451  * @param   startupInfo     Startup info of the toolbox tool to lookup error code for.
    2452  * @param   lExitCode       The toolbox tool's exit code to lookup IPRT error for.
     2444 * @return  int         Returned IPRT error for the particular tool.
     2445 * @param   startupInfo Startup info of the toolbox tool to lookup error code for.
     2446 * @param   iExitCode   The toolbox tool's exit code to lookup IPRT error for.
    24532447 */
    24542448/* static */
    2455 int GuestProcessTool::i_exitCodeToRc(const GuestProcessStartupInfo &startupInfo, LONG lExitCode)
     2449int GuestProcessTool::i_exitCodeToRc(const GuestProcessStartupInfo &startupInfo, int32_t iExitCode)
    24562450{
    24572451    if (startupInfo.mArguments.size() == 0)
     
    24612455    }
    24622456
    2463     return i_exitCodeToRc(startupInfo.mArguments[0].c_str(), lExitCode);
     2457    return i_exitCodeToRc(startupInfo.mArguments[0].c_str(), iExitCode);
    24642458}
    24652459
     
    24692463 * @return  Returned IPRT error for the particular tool.
    24702464 * @param   pszTool     Name of toolbox tool to lookup error code for.
    2471  * @param   lExitCode   The toolbox tool's exit code to lookup IPRT error for.
     2465 * @param   iExitCode   The toolbox tool's exit code to lookup IPRT error for.
    24722466 */
    24732467/* static */
    2474 int GuestProcessTool::i_exitCodeToRc(const char *pszTool, LONG lExitCode)
     2468int GuestProcessTool::i_exitCodeToRc(const char *pszTool, int32_t iExitCode)
    24752469{
    24762470    AssertPtrReturn(pszTool, VERR_INVALID_POINTER);
    24772471
    2478     LogFlowFunc(("%s: %ld\n", pszTool, lExitCode));
    2479 
    2480     if (lExitCode == 0) /* No error? Bail out early. */
     2472    LogFlowFunc(("%s: %d\n", pszTool, iExitCode));
     2473
     2474    if (iExitCode == 0) /* No error? Bail out early. */
    24812475        return VINF_SUCCESS;
    24822476
    24832477    if (!RTStrICmp(pszTool, VBOXSERVICE_TOOL_CAT))
    24842478    {
    2485         switch (lExitCode)
     2479        switch (iExitCode)
    24862480        {
    24872481            case VBOXSERVICETOOLBOX_CAT_EXITCODE_ACCESS_DENIED:     return VERR_ACCESS_DENIED;
     
    24952489    else if (!RTStrICmp(pszTool, VBOXSERVICE_TOOL_STAT))
    24962490    {
    2497         switch (lExitCode)
     2491        switch (iExitCode)
    24982492        {
    24992493            case VBOXSERVICETOOLBOX_STAT_EXITCODE_ACCESS_DENIED:    return VERR_ACCESS_DENIED;
     
    25042498        }
    25052499    }
    2506 
    2507     AssertMsgFailed(("Error code %ld for tool '%s' not handled\n", lExitCode, pszTool));
     2500    else if (!RTStrICmp(pszTool, VBOXSERVICE_TOOL_MKDIR))
     2501    {
     2502        switch (iExitCode)
     2503        {
     2504            case RTEXITCODE_FAILURE:                                return VERR_CANT_CREATE;
     2505        }
     2506    }
     2507
     2508#ifdef DEBUG_andy
     2509    AssertMsgFailed(("Exit code %d for tool '%s' not handled\n", iExitCode, pszTool));
     2510#endif
     2511    if (iExitCode == RTEXITCODE_SYNTAX)
     2512        return VERR_INTERNAL_ERROR_5;
    25082513    return VERR_GENERAL_FAILURE;
    25092514}
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