diff options
Diffstat (limited to 'threadproc/beos')
-rw-r--r-- | threadproc/beos/proc.c | 38 | ||||
-rw-r--r-- | threadproc/beos/signals.c | 7 |
2 files changed, 27 insertions, 18 deletions
diff --git a/threadproc/beos/proc.c b/threadproc/beos/proc.c index 4f387f371..441e4cd2d 100644 --- a/threadproc/beos/proc.c +++ b/threadproc/beos/proc.c @@ -218,28 +218,33 @@ ap_status_t ap_create_process(struct proc_t **new, const char *progname, i++; } - newargs = (char**)malloc(sizeof(char *) * (i + 3)); - newargs[0] = "/boot/home/config/bin/apr_proc_stub"; + newargs = (char**)malloc(sizeof(char *) * (i + 4)); + newargs[0] = strdup("/boot/home/config/bin/apr_proc_stub"); if (attr->currdir == NULL) { - /* we require the directory ! */ + /* we require the directory , so use a temp. variable */ dir = malloc(sizeof(char) * PATH_MAX); getcwd(dir, PATH_MAX); - newargs[1] = dir; + newargs[1] = strdup(dir); free(dir); } else { - newargs[1] = attr->currdir; - } - newargs[2] = progname; - i=0;nargs = 3; + newargs[1] = strdup(attr->currdir); + } + newargs[2] = strdup(progname); + i=0;nargs = 3; - while (args && args[i]) { - newargs[nargs] = args[i]; - i++;nargs++; - } - newargs[nargs] = NULL; + while (args && args[i]) { + newargs[nargs] = strdup(args[i]); + i++;nargs++; + } + newargs[nargs] = NULL; newproc = load_image(nargs, newargs, env); - free(newargs); + + /* load_image copies the data so now we can free it... */ + while (--nargs >= 0) + free (newargs[nargs]); + free(newargs); + if ( newproc < B_NO_ERROR) { return errno; } @@ -306,9 +311,8 @@ ap_status_t ap_wait_proc(struct proc_t *proc, if (get_thread_info(proc->tid, &tinfo) == B_BAD_VALUE) { return APR_CHILD_DONE; } - else { - return APR_CHILD_NOTDONE; - } + /* if we get this far it's still going... */ + return APR_CHILD_NOTDONE; } ap_status_t ap_setprocattr_childin(struct procattr_t *attr, ap_file_t *child_in, diff --git a/threadproc/beos/signals.c b/threadproc/beos/signals.c index 4fdff6b11..4cccc6e1b 100644 --- a/threadproc/beos/signals.c +++ b/threadproc/beos/signals.c @@ -57,7 +57,12 @@ ap_status_t ap_kill(struct proc_t *proc, int signal) { - if (kill(proc->pid, signal) == -1){ +/* I've changed this to use kill_thread instead of kill() as kill() + tended to kill the whole server! This isn't as good as it ignores + the signal being sent but gives more protection over what is killed. + I'll investiagte what was going on and hopefully fix it fully. +*/ + if (kill_thread(proc->tid) != B_OK){ return errno; } return APR_SUCCESS; |