167 |
|
CloseHandle(hFromChildWrite); hFromChildWrite = NULL; |
168 |
|
CloseHandle(hToChildRead); hToChildRead = NULL; |
169 |
|
/* get the file descriptors */ |
170 |
< |
proc->r = _open_osfhandle((long)hRead, _O_RDONLY); |
171 |
< |
proc->w = _open_osfhandle((long)hWrite, _O_APPEND); |
170 |
> |
proc->r = _open_osfhandle((long)hRead, _O_RDONLY|_O_BINARY); |
171 |
> |
proc->w = _open_osfhandle((long)hWrite, _O_APPEND|_O_BINARY); |
172 |
|
proc->pid = PInfo.dwProcessId; |
173 |
|
proc->running = 1; |
174 |
|
CloseHandle(hCurProc); |
185 |
|
if(hWrite) CloseHandle(hWrite); |
186 |
|
if(hCurProc) CloseHandle(hCurProc); |
187 |
|
proc->running = 0; |
188 |
< |
return 0; |
188 |
> |
return -1; |
189 |
|
/* There... Are we happy now? */ |
190 |
|
} |
191 |
|
|
279 |
|
char *cmdpath; |
280 |
|
char *cmdstr; |
281 |
|
|
282 |
+ |
if (av == NULL || av[0] == NULL) { |
283 |
+ |
fputs("Illegal call to open_process()!\n", stderr); |
284 |
+ |
return -1; |
285 |
+ |
} |
286 |
|
proc->running = 0; |
287 |
+ |
if (av == NULL) { return -1; } |
288 |
|
cmdpath = getpath(av[0], getenv("PATH"), X_OK); |
289 |
< |
cmdstr = quoted_cmdline(cmdpath, av); |
289 |
> |
cmdstr = quoted_cmdline(cmdpath, av+1); |
290 |
|
if (cmdstr == NULL) { return 0; } |
291 |
|
return start_process(proc, cmdstr); |
292 |
|
} |
330 |
|
/* something went wrong: enforce infanticide */ |
331 |
|
/* other than that, it looks like we want to ignore errors here */ |
332 |
|
if (proc->running) { |
333 |
< |
int win_kill(pid, 0); |
333 |
> |
win_kill(pid, 0); |
334 |
|
} |
335 |
|
} |
336 |
|
proc->running = 0; |