You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by st...@apache.org on 2004/08/24 03:43:35 UTC
cvs commit: apr/threadproc/win32 proc.c
stoddard 2004/08/23 18:43:34
Modified: include/arch/win32 apr_arch_threadproc.h
threadproc/win32 proc.c
Log:
Win32: Implement apr_procattr_child_errfn_set()and apr_procattr_error_check_set() on Windows
Revision Changes Path
1.4 +2 -0 apr/include/arch/win32/apr_arch_threadproc.h
Index: apr_arch_threadproc.h
===================================================================
RCS file: /home/cvs/apr/include/arch/win32/apr_arch_threadproc.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apr_arch_threadproc.h 1 Mar 2004 21:05:44 -0000 1.3
+++ apr_arch_threadproc.h 24 Aug 2004 01:43:34 -0000 1.4
@@ -54,6 +54,8 @@
char *currdir;
apr_int32_t cmdtype;
apr_int32_t detached;
+ apr_child_errfn_t *errfn;
+ apr_int32_t errchk;
};
struct apr_thread_once_t {
1.94 +38 -2 apr/threadproc/win32/proc.c
Index: proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- proc.c 23 Jun 2004 12:20:44 -0000 1.93
+++ proc.c 24 Aug 2004 01:43:34 -0000 1.94
@@ -245,14 +245,14 @@
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 @@
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 @@
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 @@
{
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 @@
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 @@
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 @@
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 @@
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;
}
}