httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@hyperreal.org
Subject cvs commit: apache-2.0/src/lib/apr/threadproc/os2 proc.c
Date Wed, 03 Nov 1999 08:06:01 GMT
bjh         99/11/03 00:06:01

  Modified:    src/lib/apr/threadproc/os2 proc.c
  Log:
  Some fixes for OS/2 process creation:
  - Allow NULL environment block
  - Allow .exe extension to be omitted
  
  Revision  Changes    Path
  1.10      +20 -13    apache-2.0/src/lib/apr/threadproc/os2/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/os2/proc.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- proc.c	1999/10/26 15:16:56	1.9
  +++ proc.c	1999/11/03 08:06:00	1.10
  @@ -261,15 +261,19 @@
       interpreter[0] = 0;
       extension = strrchr(progname, '.');
   
  -    if (extension == NULL)
  +    if (extension == NULL || strchr(extension, '/') || strchr(extension, '\\'))
           extension = "";
   
       if (attr->cmdtype == APR_SHELLCMD || strcasecmp(extension, ".cmd") == 0) {
           strcpy(interpreter, "#!" SHELL_PATH);
           extra_arg = "/C";
  -    } else if (stricmp(progname, ".exe") != 0) {
  +    } else if (stricmp(extension, ".exe") != 0) {
           status = ap_open(&progfile, progname, APR_READ|APR_BUFFERED, 0, cont);
   
  +        if (status == APR_ENOENT) {
  +            progname = ap_pstrcat(cont, progname, ".exe", NULL);
  +        }
  +
           if (status == APR_SUCCESS) {
               status = ap_fgets(interpreter, sizeof(interpreter), progfile);
   
  @@ -350,18 +354,21 @@
       }
   
       /* Create environment block from list of envariables */
  -    for (env_len=1, e=0; env[e]; e++)
  -        env_len += strlen(env[e]) + 1;
  -
  -    env_block = ap_palloc(cont, env_len);
  -    env_block_pos = env_block;
  -
  -    for (e=0; env[e]; e++) {
  -        strcpy(env_block_pos, env[e]);
  -        env_block_pos += strlen(env_block_pos) + 1;
  -    }
  +    if (env) {
  +        for (env_len=1, e=0; env[e]; e++)
  +            env_len += strlen(env[e]) + 1;
  +
  +        env_block = ap_palloc(cont, env_len);
  +        env_block_pos = env_block;
  +
  +        for (e=0; env[e]; e++) {
  +            strcpy(env_block_pos, env[e]);
  +            env_block_pos += strlen(env_block_pos) + 1;
  +        }
   
  -    *env_block_pos = 0; /* environment block is terminated by a double null */
  +        *env_block_pos = 0; /* environment block is terminated by a double null */
  +    } else
  +        env_block = NULL;
   
       status = DosExecPgm(error_object, sizeof(error_object), 
                           attr->detached ? EXEC_BACKGROUND : EXEC_ASYNC, 
  
  
  

Mime
View raw message