Merge pull request #2758 from bmiklautz/fix/CreateProcess
CreateProcess misc fixes
This commit is contained in:
commit
87c5377f42
@ -241,7 +241,7 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
lpszEnvironmentBlock = GetEnvironmentStrings();
|
lpszEnvironmentBlock = GetEnvironmentStrings();
|
||||||
if (lpszEnvironmentBlock)
|
if (!lpszEnvironmentBlock)
|
||||||
goto finish;
|
goto finish;
|
||||||
envp = EnvironmentBlockToEnvpA(lpszEnvironmentBlock);
|
envp = EnvironmentBlockToEnvpA(lpszEnvironmentBlock);
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
|||||||
|
|
||||||
/* set default signal handlers */
|
/* set default signal handlers */
|
||||||
memset(&act, 0, sizeof(act));
|
memset(&act, 0, sizeof(act));
|
||||||
act.sa_sigaction = SIG_DFL;
|
act.sa_handler = SIG_DFL;
|
||||||
act.sa_flags = 0;
|
act.sa_flags = 0;
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
for (sig = 1; sig < NSIG; sig++)
|
for (sig = 1; sig < NSIG; sig++)
|
||||||
@ -317,11 +317,12 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
|||||||
if (token->UserId)
|
if (token->UserId)
|
||||||
setuid((uid_t) token->UserId);
|
setuid((uid_t) token->UserId);
|
||||||
|
|
||||||
/* TODO: add better cwd handling and error checking */
|
|
||||||
if (lpCurrentDirectory && strlen(lpCurrentDirectory) > 0)
|
|
||||||
chdir(lpCurrentDirectory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: add better cwd handling and error checking */
|
||||||
|
if (lpCurrentDirectory && strlen(lpCurrentDirectory) > 0)
|
||||||
|
chdir(lpCurrentDirectory);
|
||||||
|
|
||||||
if (execve(filename, pArgs, envp) < 0)
|
if (execve(filename, pArgs, envp) < 0)
|
||||||
{
|
{
|
||||||
/* execve failed - end the process */
|
/* execve failed - end the process */
|
||||||
|
Loading…
Reference in New Issue
Block a user