diff options
author | Bill Stoddard <stoddard@apache.org> | 2004-08-24 01:43:34 +0000 |
---|---|---|
committer | Bill Stoddard <stoddard@apache.org> | 2004-08-24 01:43:34 +0000 |
commit | 29ed0f4192c6cd9051165b26ef8ad0575ff65581 (patch) | |
tree | 41231039bfd67b8f0dbfcf4c1fcca390c257c28f /threadproc | |
parent | c809de0db32eb014d66bef145e567f774bd6f1a8 (diff) | |
download | apr-29ed0f4192c6cd9051165b26ef8ad0575ff65581.tar.gz |
Win32: Implement apr_procattr_child_errfn_set()and apr_procattr_error_check_set() on Windows
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65307 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r-- | threadproc/win32/proc.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index e7c21c105..191d682d4 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -245,14 +245,14 @@ static char *apr_caret_escape_args(apr_pool_t *p, const char *str) APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr, apr_child_errfn_t *errfn) { - /* won't ever be called on this platform, so don't save the function pointer */ + attr->errfn = errfn; return APR_SUCCESS; } APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr, apr_int32_t chk) { - /* won't ever be used on this platform, so don't save the flag */ + attr->errchk = chk; return APR_SUCCESS; } @@ -311,6 +311,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, char *fullpath = NULL; if ((rv = apr_filepath_merge(&fullpath, attr->currdir, progname, APR_FILEPATH_NATIVE, pool)) != APR_SUCCESS) { + if (attr->errfn) { + attr->errfn(pool, rv, + apr_pstrcat(pool, "filepath_merge failed.", + " currdir: ", attr->currdir, + " progname: ", progname, NULL)); + } return rv; } progname = fullpath; @@ -352,6 +358,9 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if (attr->cmdtype == APR_SHELLCMD || attr->cmdtype == APR_SHELLCMD_ENV) { char *shellcmd = getenv("COMSPEC"); if (!shellcmd) { + if (attr->errfn) { + attr->errfn(pool, APR_EINVAL, "COMSPEC envar is not set"); + } return APR_EINVAL; } if (shellcmd[0] == '"') { @@ -388,6 +397,9 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, { char *shellcmd = getenv("COMSPEC"); if (!shellcmd) { + if (attr->errfn) { + attr->errfn(pool, APR_EINVAL, "COMSPEC envar is not set"); + } return APR_EINVAL; } if (shellcmd[0] == '"') { @@ -479,6 +491,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if ((rv = apr_conv_utf8_to_ucs2(env[i], &in, pNext, &iEnvBlockLen)) != APR_SUCCESS) { + if (attr->errfn) { + attr->errfn(pool, rv, + apr_pstrcat(pool, + "utf8 to ucs2 conversion failed" + " on this string: ", env[i], NULL)); + } return rv; } pNext = wcschr(pNext, L'\0') + 1; @@ -525,6 +543,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, wprg = apr_palloc(pool, nwprg * sizeof(wprg[0])); if ((rv = apr_conv_utf8_to_ucs2(progname, &nprg, wprg, &nwprg)) != APR_SUCCESS) { + if (attr->errfn) { + attr->errfn(pool, rv, + apr_pstrcat(pool, + "utf8 to ucs2 conversion failed" + " on progname: ", progname, NULL)); + } return rv; } } @@ -535,6 +559,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, wcmd = apr_palloc(pool, nwcmd * sizeof(wcmd[0])); if ((rv = apr_conv_utf8_to_ucs2(cmdline, &ncmd, wcmd, &nwcmd)) != APR_SUCCESS) { + if (attr->errfn) { + attr->errfn(pool, rv, + apr_pstrcat(pool, + "utf8 to ucs2 conversion failed" + " on cmdline: ", cmdline, NULL)); + } return rv; } } @@ -547,6 +577,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if ((rv = apr_conv_utf8_to_ucs2(attr->currdir, &ncwd, wcwd, &nwcwd)) != APR_SUCCESS) { + if (attr->errfn) { + attr->errfn(pool, rv, + apr_pstrcat(pool, + "utf8 to ucs2 conversion failed" + " on currdir: ", attr->currdir, NULL)); + } return rv; } } |