Ticket #441: proc_open.c.2.diff
| File proc_open.c.2.diff, 1.0 kB (added by elvstone@…, 3 years ago) |
|---|
-
src/proc_open.c
1 #include <string.h> 1 2 #include <stdlib.h> 2 3 #include <stdio.h> 3 4 #include <ctype.h> … … 148 149 STARTUPINFO si; 149 150 BOOL procok; 150 151 SECURITY_ATTRIBUTES security; 151 c onst char *shell;152 char *shell; 152 153 buffer *cmdline; 153 154 154 155 if (NULL == (shell = getenv(SHELLENV))) { 155 fprintf(stderr, "env %s is required", SHELLENV); 156 return -1; 156 if (NULL == (shell = getenv("WINDIR"))) { 157 fprintf(stderr, "neither %s nor WINDIR in env, can't guess shell path\n", SHELLENV); 158 return -1; 159 } 160 shell = strcat(shell, "\\system32\\cmd.exe"); 157 161 } 158 162 159 163 /* we use this to allow the child to inherit handles */ … … 225 229 pid_t child; 226 230 const char *shell; 227 231 228 if (NULL == (shell = getenv(SHELLENV))) { 229 fprintf(stderr, "env %s is required", SHELLENV); 230 return -1; 231 } 232 if (NULL == (shell = getenv(SHELLENV))) 233 shell = "/bin/sh"; 232 234 233 235 if (proc_open_pipes(proc) != 0) { 234 236 return -1;

