stoddard 2004/08/25 05:56:40
Modified: include/arch/win32 Tag: APR_0_9_BRANCH apr_arch_threadproc.h
threadproc/win32 Tag: APR_0_9_BRANCH proc.c
Log:
Win32: Implement apr_procattr_child_errfn_set()and
apr_procattr_error_check_set() on Windows
Revision Changes Path
No revision
No revision
1.1.2.2 +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.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- apr_arch_threadproc.h 13 Feb 2004 09:33:47 -0000 1.1.2.1
+++ apr_arch_threadproc.h 25 Aug 2004 12:56:39 -0000 1.1.2.2
@@ -53,6 +53,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 {
No revision
No revision
1.90.2.3 +38 -2 apr/threadproc/win32/proc.c
Index: proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
retrieving revision 1.90.2.2
retrieving revision 1.90.2.3
diff -u -r1.90.2.2 -r1.90.2.3
--- proc.c 23 Jun 2004 15:07:59 -0000 1.90.2.2
+++ proc.c 25 Aug 2004 12:56:40 -0000 1.90.2.3
@@ -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;
}
@@ -304,6 +304,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;
@@ -345,6 +351,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] == '"') {
@@ -381,6 +390,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] == '"') {
@@ -472,6 +484,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;
@@ -518,6 +536,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;
}
}
@@ -528,6 +552,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;
}
}
@@ -540,6 +570,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;
}
}