diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2004-06-23 15:07:59 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2004-06-23 15:07:59 +0000 |
commit | a98767cfabbf65ddbc4a68e87c0fa02ef572909c (patch) | |
tree | d797005245e73a7a38848d054d517f1fc8dc6159 /threadproc | |
parent | 7b074bf785d8bc820aa13a11e2a4ad0b078b41b5 (diff) | |
download | libapr-a98767cfabbf65ddbc4a68e87c0fa02ef572909c.tar.gz |
backport this from 1.0-dev:
*) Add command type APR_SHELLCMD_ENV for creating a process
which is started by the shell and which inherits the parent's
environment variables.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/APR_0_9_BRANCH@65215 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r-- | threadproc/os2/proc.c | 4 | ||||
-rw-r--r-- | threadproc/unix/proc.c | 10 | ||||
-rw-r--r-- | threadproc/win32/proc.c | 6 |
3 files changed, 15 insertions, 5 deletions
diff --git a/threadproc/os2/proc.c b/threadproc/os2/proc.c index 8fa508fef..abcacbb57 100644 --- a/threadproc/os2/proc.c +++ b/threadproc/os2/proc.c @@ -326,7 +326,9 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname /* ### how to handle APR_PROGRAM_ENV and APR_PROGRAM_PATH? */ - if (attr->cmdtype == APR_SHELLCMD || strcasecmp(extension, ".cmd") == 0) { + if (attr->cmdtype == APR_SHELLCMD || + attr->cmdtype == APR_SHELLCMD_ENV || + strcasecmp(extension, ".cmd") == 0) { strcpy(interpreter, "#!" SHELL_PATH); extra_arg = "/C"; } else if (stricmp(extension, ".exe") != 0) { diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c index 8d0f2126e..f50113aa7 100644 --- a/threadproc/unix/proc.c +++ b/threadproc/unix/proc.c @@ -382,7 +382,8 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, exit(-1); /* We have big problems, the child should exit. */ } - if (attr->cmdtype == APR_SHELLCMD) { + if (attr->cmdtype == APR_SHELLCMD || + attr->cmdtype == APR_SHELLCMD_ENV) { int onearg_len = 0; const char *newargs[4]; @@ -433,7 +434,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, apr_proc_detach(APR_PROC_DETACH_DAEMONIZE); } - execve(SHELL_PATH, (char * const *) newargs, (char * const *)env); + if (attr->cmdtype == APR_SHELLCMD) { + execve(SHELL_PATH, (char * const *) newargs, (char * const *)env); + } + else { + execv(SHELL_PATH, (char * const *)newargs); + } } else if (attr->cmdtype == APR_PROGRAM) { if (attr->detached) { diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index 777367304..8ecc5c612 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -342,7 +342,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } #ifndef _WIN32_WCE - if (attr->cmdtype == APR_SHELLCMD) { + if (attr->cmdtype == APR_SHELLCMD || attr->cmdtype == APR_SHELLCMD_ENV) { char *shellcmd = getenv("COMSPEC"); if (!shellcmd) { return APR_EINVAL; @@ -438,8 +438,10 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } } - if (!env || attr->cmdtype == APR_PROGRAM_ENV) + if (!env || attr->cmdtype == APR_PROGRAM_ENV || + attr->cmdtype == APR_SHELLCMD_ENV) { pEnvBlock = NULL; + } else { apr_size_t iEnvBlockLen; /* |