Patch TSRM_Win32_COMSPEC.patch for Program Execution Bug #50271
Patch version 2010-03-26 13:05 UTC
Return to Bug #50271 |
Download this patch
Patch Revisions:
Developer: rquadling@php.net
Index: tsrm_win32.c
===================================================================
--- tsrm_win32.c (revision 296837)
+++ tsrm_win32.c (working copy)
@@ -42,12 +42,19 @@
static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
{
+ char dummybuf;
+ int size;
+
globals->process = NULL;
globals->shm = NULL;
globals->process_size = 0;
globals->shm_size = 0;
- globals->comspec = _strdup((GetVersion()<0x80000000)?"cmd.exe":"command.com");
+ SetLastError(0);
+ size = GetEnvironmentVariableA("COMSPEC", &dummybuf, 0);
+ globals->comspec = malloc(size);
+ GetEnvironmentVariableA("COMSPEC", globals->comspec, size);
+
/* Set it to INVALID_HANDLE_VALUE
* It will be initialized correctly in tsrm_win32_access or set to
* NULL if no impersonation has been done.
|