VirtualBox

Ignore:
Timestamp:
Jun 24, 2020 8:57:02 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
138795
Message:

Validation Kit/TXS: Resolve executables for EXEC command before feeding into into RTProcCreateEx().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp

    r84922 r84923  
    27902790    if (RT_SUCCESS(rc))
    27912791    {
    2792         /*
    2793          * Create the process.
    2794          */
    2795         if (g_fDisplayOutput)
     2792        char *pszExecResolved = RTPathRealDup(pszExecName);
     2793        if (pszExecResolved)
    27962794        {
    2797             RTPrintf("txs: Executing \"%s\": ", pszExecName);
    2798             for (uint32_t i = 0; i < cArgs; i++)
    2799                 RTPrintf(" \"%s\"", papszArgs[i]);
    2800             RTPrintf("\n");
    2801         }
    2802         rc = RTProcCreateEx(pszExecName, papszArgs, pTxsExec->hEnv, 0 /*fFlags*/,
    2803                             pTxsExec->StdIn.phChild, pTxsExec->StdOut.phChild, pTxsExec->StdErr.phChild,
    2804                             *pszUsername ? pszUsername : NULL, NULL, NULL,
    2805                             &pTxsExec->hProcess);
    2806         if (RT_SUCCESS(rc))
    2807         {
    2808             ASMAtomicWriteBool(&pTxsExec->fProcessAlive, true);
    2809             rc2 = RTThreadUserSignal(pTxsExec->hThreadWaiter); AssertRC(rc2);
    2810 
    28112795            /*
    2812              * Close the child ends of any pipes and redirected files.
     2796             * Create the process.
    28132797             */
    2814             rc2 = RTHandleClose(pTxsExec->StdIn.phChild);   AssertRC(rc2);
    2815             pTxsExec->StdIn.phChild     = NULL;
    2816             rc2 = RTHandleClose(pTxsExec->StdOut.phChild);  AssertRC(rc2);
    2817             pTxsExec->StdOut.phChild    = NULL;
    2818             rc2 = RTHandleClose(pTxsExec->StdErr.phChild);  AssertRC(rc2);
    2819             pTxsExec->StdErr.phChild    = NULL;
    2820             rc2 = RTPipeClose(pTxsExec->hTestPipeW);        AssertRC(rc2);
    2821             pTxsExec->hTestPipeW        = NIL_RTPIPE;
    2822 
    2823             /*
    2824              * Let another worker function funnel output and input to the
    2825              * client as well as the process exit code.
    2826              */
    2827             rc = txsDoExecHlp2(pTxsExec);
     2798            if (g_fDisplayOutput)
     2799            {
     2800                RTPrintf("txs: Executing \"%s\" -> \"%s\": ", pszExecName, pszExecResolved);
     2801                for (uint32_t i = 0; i < cArgs; i++)
     2802                    RTPrintf(" \"%s\"", papszArgs[i]);
     2803                RTPrintf("\n");
     2804            }
     2805
     2806            rc = RTProcCreateEx(pszExecResolved, papszArgs, pTxsExec->hEnv, 0 /*fFlags*/,
     2807                                pTxsExec->StdIn.phChild, pTxsExec->StdOut.phChild, pTxsExec->StdErr.phChild,
     2808                                *pszUsername ? pszUsername : NULL, NULL, NULL,
     2809                                &pTxsExec->hProcess);
     2810            if (RT_SUCCESS(rc))
     2811            {
     2812                ASMAtomicWriteBool(&pTxsExec->fProcessAlive, true);
     2813                rc2 = RTThreadUserSignal(pTxsExec->hThreadWaiter); AssertRC(rc2);
     2814
     2815                /*
     2816                 * Close the child ends of any pipes and redirected files.
     2817                 */
     2818                rc2 = RTHandleClose(pTxsExec->StdIn.phChild);   AssertRC(rc2);
     2819                pTxsExec->StdIn.phChild     = NULL;
     2820                rc2 = RTHandleClose(pTxsExec->StdOut.phChild);  AssertRC(rc2);
     2821                pTxsExec->StdOut.phChild    = NULL;
     2822                rc2 = RTHandleClose(pTxsExec->StdErr.phChild);  AssertRC(rc2);
     2823                pTxsExec->StdErr.phChild    = NULL;
     2824                rc2 = RTPipeClose(pTxsExec->hTestPipeW);        AssertRC(rc2);
     2825                pTxsExec->hTestPipeW        = NIL_RTPIPE;
     2826
     2827                /*
     2828                 * Let another worker function funnel output and input to the
     2829                 * client as well as the process exit code.
     2830                 */
     2831                rc = txsDoExecHlp2(pTxsExec);
     2832            }
     2833            else
     2834                rc = txsReplyFailure(pPktHdr, "FAILED  ", "Executing process \"%s\" failed with %Rrc",
     2835                                     pszExecResolved, rc);
     2836
     2837            RTStrFree(pszExecResolved);
    28282838        }
    28292839        else
    2830             rc = txsReplyFailure(pPktHdr, "FAILED  ", "Executing process \"%s\" failed with %Rrc",
    2831                                  pszExecName, rc);
     2840            rc = VERR_NO_MEMORY;
    28322841    }
    28332842    else
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