Changeset 4475 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Sep 1, 2007 1:21:19 AM (17 years ago)
- Location:
- trunk/src/VBox/Runtime/r3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/env-posix.cpp
r4071 r4475 23 23 #include <iprt/string.h> 24 24 #include <iprt/alloca.h> 25 #include <iprt/assert.h> 25 26 26 27 #include <stdlib.h> … … 76 77 } 77 78 79 80 RTDECL(int) RTEnvUnset(const char *pszVar) 81 { 82 AssertReturn(!strchr(pszVar, '='), VERR_INVALID_PARAMETER); 83 84 /* Check that it exists first. */ 85 if (!RTEnvExist(pszVar)) 86 return VINF_ENV_VAR_NOT_FOUND; 87 88 /* Ok, try remove it. */ 89 if (!putenv((char *)pszVar)) 90 return VINF_SUCCESS; 91 return RTErrConvertFromErrno(errno); 92 } 93 -
trunk/src/VBox/Runtime/r3/posix/process-posix.cpp
r4071 r4475 42 42 #include <iprt/assert.h> 43 43 #include <iprt/err.h> 44 #include <iprt/env.h> 44 45 #include "internal/process.h" 45 46 46 47 47 48 48 RTR3DECL(int) RTProcCreate(const char *pszExec, const char * const *papszArgs, const char * const *papszEnv, unsigned fFlags, PRTPROCESS pProcess)49 RTR3DECL(int) RTProcCreate(const char *pszExec, const char * const *papszArgs, RTENV Env, unsigned fFlags, PRTPROCESS pProcess) 49 50 { 50 51 /* 51 52 * Validate input. 52 53 */ 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); 63 60 /* later: path searching. */ 64 61 … … 100 97 /** @todo check if it requires any of those two attributes, don't remember atm. */ 101 98 int rc = posix_spawn(&pid, pszExec, NULL, NULL, (char * const *)papszArgs, 102 papszEnv ? (char * const *)papszEnv : environ);99 (char * const *)papszEnv); 103 100 if (!rc) 104 101 { … … 114 111 { 115 112 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); 120 114 AssertReleaseMsgFailed(("execve returns %d errno=%d\n", rc, errno)); 121 115 exit(127); -
trunk/src/VBox/Runtime/r3/win32/process-win32.cpp
r4071 r4475 29 29 #include <iprt/assert.h> 30 30 #include <iprt/err.h> 31 #include <iprt/env.h> 31 32 32 33 … … 69 70 /** @todo r=michael This function currently does not work correctly if the arguments 70 71 contain spaces. */ 71 RTR3DECL(int) RTProcCreate(const char *pszExec, const char * const *papszArgs, const char * const *papszEnv, unsigned fFlags, PRTPROCESS pProcess)72 RTR3DECL(int) RTProcCreate(const char *pszExec, const char * const *papszArgs, RTENV Env, unsigned fFlags, PRTPROCESS pProcess) 72 73 { 73 74 /* 74 75 * Validate input. 75 76 */ 76 if (!pszExec || !*pszExec) 77 { 78 AssertMsgFailed(("no exec\n")); 79 return VERR_INVALID_PARAMETER; 80 } 81 if (fFlags) 82 { 83 AssertMsgFailed(("invalid flags!\n")); 84 return VERR_INVALID_PARAMETER; 85 } 77 AssertPtrReturn(pszExec, VERR_INVALID_POINTER); 78 AssertReturn(*pszExec, VERR_INVALID_PARAMETER); 79 AssertReturn(!fFlags, VERR_INVALID_PARAMETER); 80 AssertReturn(Env != NIL_RTENV, VERR_INVALID_PARAMETER); 81 const char * const *papszEnv = RTEnvGetExecEnvP(Env); 82 AssertPtrReturn(papszEnv, VERR_INVALID_HANDLE); 86 83 /* later: path searching. */ 87 84 88 85 /* 89 86 * Spawn the child.
Note:
See TracChangeset
for help on using the changeset viewer.