You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dr...@locus.apache.org on 2000/03/14 01:52:46 UTC

cvs commit: apache-2.0/src/lib/apr/threadproc/beos proc.c signals.c

dreid       00/03/13 16:52:46

  Modified:    src/lib/apr/threadproc/beos proc.c signals.c
  Log:
  Bunch of changes to get CGI's working better on BeOS.
  
  Revision  Changes    Path
  1.17      +22 -18    apache-2.0/src/lib/apr/threadproc/beos/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/beos/proc.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- proc.c	2000/03/10 00:06:37	1.16
  +++ proc.c	2000/03/14 00:52:46	1.17
  @@ -218,28 +218,33 @@
           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;
  -
  -	while (args && args[i]) {
  -		newargs[nargs] = args[i];
  -		i++;nargs++;
  -	}
  -	newargs[nargs] = NULL;
  +        newargs[1] = strdup(attr->currdir);
  +    }
  +    newargs[2] = strdup(progname);
  +    i=0;nargs = 3;
  +
  +    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;
       }
  @@ -305,10 +310,9 @@
          this won't hang or holdup the thread checking... */
       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,
  
  
  
  1.4       +6 -1      apache-2.0/src/lib/apr/threadproc/beos/signals.c
  
  Index: signals.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/beos/signals.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- signals.c	2000/03/10 00:06:37	1.3
  +++ signals.c	2000/03/14 00:52:46	1.4
  @@ -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;