Changeset 1060
- Timestamp:
- 03/30/2006 06:01:37 AM (2 years ago)
- Files:
-
- 1 modified
-
branches/lighttpd-merge-1.4.x/src/proc_open.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/lighttpd-merge-1.4.x/src/proc_open.c
r530 r1060 149 149 BOOL procok; 150 150 SECURITY_ATTRIBUTES security; 151 const char *shell; 151 const char *shell = NULL; 152 const char *windir = NULL; 152 153 buffer *cmdline; 153 154 154 if (NULL == (shell = getenv(SHELLENV))) { 155 fprintf(stderr, "env %s is required", SHELLENV); 155 if (NULL == (shell = getenv(SHELLENV)) && 156 NULL == (windir = getenv("SystemRoot")) && 157 NULL == (windir = getenv("windir"))) { 158 fprintf(stderr, "One of %s,%%SystemRoot,%%windir is required", SHELLENV); 156 159 return -1; 157 160 } … … 178 181 179 182 cmdline = buffer_init(); 180 buffer_append_string(cmdline, shell); 183 if (shell) { 184 buffer_append_string(cmdline, shell); 185 } else { 186 buffer_append_string(cmdline, windir); 187 buffer_append_string(cmdline, "\\system32\\cmd.exe"); 188 } 181 189 buffer_append_string_len(cmdline, CONST_STR_LEN(" /c ")); 182 190 buffer_append_string(cmdline, command); 183 191 procok = CreateProcess(NULL, cmdline->ptr, &security, &security, TRUE, 184 192 NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi); 193 194 if (FALSE == procok) { 195 fprintf(stderr, "failed to CreateProcess: %s", cmdline->ptr); 196 buffer_free(cmdline); 197 return -1; 198 } 185 199 buffer_free(cmdline); 186 187 if (FALSE == procok) {188 fprintf(stderr, "failed to CreateProcess");189 return -1;190 }191 200 192 201 proc->child = pi.hProcess; … … 227 236 228 237 if (NULL == (shell = getenv(SHELLENV))) { 229 fprintf(stderr, "env %s is required", SHELLENV); 230 return -1; 238 shell = "/bin/sh"; 231 239 } 232 240

