VirtualBox

Ignore:
Timestamp:
Sep 1, 2007 1:21:19 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
24074
Message:

Some adjustments to RTEnv and RTProcCreate. Should work on darwin now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/process-posix.cpp

    r4071 r4475  
    4242#include <iprt/assert.h>
    4343#include <iprt/err.h>
     44#include <iprt/env.h>
    4445#include "internal/process.h"
    4546
    4647
    4748
    48 RTR3DECL(int)   RTProcCreate(const char *pszExec, const char * const *papszArgs, const char * const *papszEnv, unsigned fFlags, PRTPROCESS pProcess)
     49RTR3DECL(int)   RTProcCreate(const char *pszExec, const char * const *papszArgs, RTENV Env, unsigned fFlags, PRTPROCESS pProcess)
    4950{
    5051    /*
    5152     * Validate input.
    5253     */
    53     if (!pszExec || !*pszExec)
    54     {
    55         AssertMsgFailed(("no exec\n"));
    56         return VERR_INVALID_PARAMETER;
    57     }
    58     if (fFlags)
    59     {
    60         AssertMsgFailed(("invalid flags!\n"));
    61         return VERR_INVALID_PARAMETER;
    62     }
     54    AssertPtrReturn(pszExec, VERR_INVALID_POINTER);
     55    AssertReturn(*pszExec, VERR_INVALID_PARAMETER);
     56    AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
     57    AssertReturn(Env != NIL_RTENV, VERR_INVALID_PARAMETER);
     58    const char * const *papszEnv = RTEnvGetExecEnvP(Env);
     59    AssertPtrReturn(papszEnv, VERR_INVALID_HANDLE);
    6360    /* later: path searching. */
    6461
     
    10097    /** @todo check if it requires any of those two attributes, don't remember atm. */
    10198    int rc = posix_spawn(&pid, pszExec, NULL, NULL, (char * const *)papszArgs,
    102                          papszEnv ? (char * const *)papszEnv : environ);
     99                         (char * const *)papszEnv);
    103100    if (!rc)
    104101    {
     
    114111    {
    115112        int rc;
    116         if (papszEnv)
    117             rc = execve(pszExec, (char * const *)papszArgs, (char * const *)papszEnv);
    118         else
    119             rc = execv(pszExec, (char * const *)papszArgs);
     113        rc = execve(pszExec, (char * const *)papszArgs, (char * const *)papszEnv);
    120114        AssertReleaseMsgFailed(("execve returns %d errno=%d\n", rc, errno));
    121115        exit(127);
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