From 4f9b76b6f2acc4030ce9ef164322514c5d0e761b Mon Sep 17 00:00:00 2001 From: Ivan Zhakov Date: Sun, 20 Nov 2022 07:14:38 +0000 Subject: Remove trailing whitespaces in *.c. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68 --- threadproc/beos/apr_proc_stub.c | 10 +-- threadproc/beos/proc.c | 62 ++++++++--------- threadproc/beos/thread.c | 12 ++-- threadproc/beos/threadpriv.c | 4 +- threadproc/beos/threadproc_common.c | 2 +- threadproc/netware/proc.c | 72 ++++++++++---------- threadproc/netware/thread.c | 8 +-- threadproc/netware/threadpriv.c | 16 ++--- threadproc/os2/proc.c | 56 ++++++++-------- threadproc/os2/thread.c | 6 +- threadproc/os2/threadpriv.c | 8 +-- threadproc/unix/proc.c | 8 +-- threadproc/unix/signals.c | 10 +-- threadproc/unix/thread.c | 4 +- threadproc/win32/proc.c | 128 ++++++++++++++++++------------------ threadproc/win32/signals.c | 6 +- threadproc/win32/thread.c | 14 ++-- threadproc/win32/threadpriv.c | 4 +- 18 files changed, 215 insertions(+), 215 deletions(-) (limited to 'threadproc') diff --git a/threadproc/beos/apr_proc_stub.c b/threadproc/beos/apr_proc_stub.c index 011d793e3..482dee986 100644 --- a/threadproc/beos/apr_proc_stub.c +++ b/threadproc/beos/apr_proc_stub.c @@ -27,7 +27,7 @@ struct pipefd { int main(int argc, char *argv[]) { /* we expect the following... - * + * * argv[0] = this stub * argv[1] = directory to run in... * argv[2] = progname to execute @@ -40,14 +40,14 @@ int main(int argc, char *argv[]) { void *buffer; char ** newargs; int i = 0; - + newargs = (char**)malloc(sizeof(char*) * (argc - 1)); - + buffer = (void*)malloc(sizeof(struct pipefd)); /* this will block until we get the data */ receive_data(&sender, buffer, sizeof(struct pipefd)); pfd = (struct pipefd*)buffer; - + if (pfd->in > STDERR_FILENO) { if (dup2(pfd->in, STDIN_FILENO) != STDIN_FILENO) return (-1); close (pfd->in); @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) { for (i=3;i<=argc;i++){ newargs[i-3] = argv[i]; } - + /* tell the caller we're OK to start */ send_data(sender,1,NULL,0); diff --git a/threadproc/beos/proc.c b/threadproc/beos/proc.c index cb09c9ff9..d35123916 100644 --- a/threadproc/beos/proc.c +++ b/threadproc/beos/proc.c @@ -30,7 +30,7 @@ struct send_pipe { APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t *pool) { - (*new) = (apr_procattr_t *)apr_palloc(pool, + (*new) = (apr_procattr_t *)apr_palloc(pool, sizeof(apr_procattr_t)); if ((*new) == NULL) { @@ -43,7 +43,7 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t * (*new)->child_out = NULL; (*new)->parent_err = NULL; (*new)->child_err = NULL; - (*new)->currdir = NULL; + (*new)->currdir = NULL; (*new)->cmdtype = APR_PROGRAM; (*new)->detached = 0; return APR_SUCCESS; @@ -58,7 +58,7 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, if ((in != APR_NO_PIPE) && (in != APR_NO_FILE)) { /* APR_CHILD_BLOCK maps to APR_WRITE_BLOCK, while - * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose + * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose * the CHILD/PARENT blocking flags for the stdin pipe. * stdout/stderr map to the correct mode by default. */ @@ -99,8 +99,8 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, - const char *dir) +APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, + const char *dir) { char * cwd; if (dir[0] != '/') { @@ -118,13 +118,13 @@ APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, } APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd) + apr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach) +APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; @@ -133,7 +133,7 @@ APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int3 APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) { int pid; - + if ((pid = fork()) < 0) { return errno; } @@ -154,7 +154,7 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) area_info ai; int32 cookie = 0; area_id highest = 0; - + while (get_next_area_info(0, &cookie, &ai) == B_OK) if (ai.area > highest) highest = ai.area; @@ -169,20 +169,20 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) ai.protection, original); } } - + #if APR_HAS_THREAD_LOCAL apr_thread_current_after_fork(); #endif proc->pid = pid; - proc->in = NULL; - proc->out = NULL; + proc->in = NULL; + proc->out = NULL; proc->err = NULL; return APR_INCHILD; } proc->pid = pid; - proc->in = NULL; - proc->out = NULL; - proc->err = NULL; + proc->in = NULL; + proc->out = NULL; + proc->err = NULL; return APR_INPARENT; } @@ -207,18 +207,18 @@ APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname, +APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname, const char * const *args, - const char * const *env, - apr_procattr_t *attr, + const char * const *env, + apr_procattr_t *attr, apr_pool_t *pool) { int i=0,nargs=0; char **newargs = NULL; thread_id newproc, sender; - struct send_pipe *sp; + struct send_pipe *sp; char * dir = NULL; - + sp = (struct send_pipe *)apr_palloc(pool, sizeof(struct send_pipe)); new->in = attr->parent_in; @@ -261,7 +261,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname, while (--nargs >= 0) free (newargs[nargs]); free(newargs); - + if (newproc < B_NO_ERROR) { return errno; } @@ -281,26 +281,26 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname, send_data(newproc, 0, (void*)sp, sizeof(struct send_pipe)); new->pid = newproc; - /* before we go charging on we need the new process to get to a + /* before we go charging on we need the new process to get to a * certain point. When it gets there it'll let us know and we * can carry on. */ receive_data(&sender, (void*)NULL,0); - + return APR_SUCCESS; } APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, int *exitcode, apr_exit_why_e *exitwhy, - apr_wait_how_e waithow, + apr_wait_how_e waithow, apr_pool_t *p) { proc->pid = -1; return apr_proc_wait(proc, exitcode, exitwhy, waithow); -} +} APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, - int *exitcode, + int *exitcode, apr_exit_why_e *exitwhy, apr_wait_how_e waithow) { @@ -343,7 +343,7 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, } return errno; -} +} APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, apr_file_t *child_in, apr_file_t *parent_in) @@ -394,7 +394,7 @@ APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_f rv = apr_file_inherit_set(attr->child_out); } } - + if (parent_out != NULL && rv == APR_SUCCESS) rv = apr_file_dup(&attr->parent_out, parent_out, attr->pool); @@ -422,20 +422,20 @@ APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_f rv = apr_file_inherit_set(attr->child_err); } } - + if (parent_err != NULL && rv == APR_SUCCESS) rv = apr_file_dup(&attr->parent_err, parent_err, attr->pool); return rv; } -APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32_t what, +APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32_t what, void *limit) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, const char *username, const char *password) { diff --git a/threadproc/beos/thread.c b/threadproc/beos/thread.c index 0d59a58f7..4f9d0408e 100644 --- a/threadproc/beos/thread.c +++ b/threadproc/beos/thread.c @@ -19,7 +19,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool_t *pool) { - (*new) = (apr_threadattr_t *)apr_palloc(pool, + (*new) = (apr_threadattr_t *)apr_palloc(pool, sizeof(apr_threadattr_t)); if ((*new) == NULL) { @@ -38,7 +38,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_ attr->detached = 1; } else { attr->detached = 0; - } + } return APR_SUCCESS; } @@ -62,7 +62,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, +APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, apr_size_t size) { attr->max_free = size; @@ -149,7 +149,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, temp = B_NORMAL_PRIORITY; /* First we create the new thread...*/ - (*new)->td = spawn_thread((thread_func)dummy_worker, + (*new)->td = spawn_thread((thread_func)dummy_worker, "apr thread", temp, (*new)); /* Now we try to run it...*/ @@ -290,7 +290,7 @@ APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, apr_thread return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd, +APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd, apr_pool_t *pool) { if (pool == NULL) { @@ -332,7 +332,7 @@ APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, -APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, +APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, void (*func)(void)) { if (!control->hit) { diff --git a/threadproc/beos/threadpriv.c b/threadproc/beos/threadpriv.c index 162e37f6e..a19b1fe4f 100644 --- a/threadproc/beos/threadpriv.c +++ b/threadproc/beos/threadpriv.c @@ -81,7 +81,7 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, apr_threadkey_t thread_id tid; int i,index = 0, ret = 0; - tid = find_thread(NULL); + tid = find_thread(NULL); for (i=0; i < BEOS_MAX_DATAKEYS; i++){ if (beos_data[i]->data){ if (beos_data[i]->td == tid){index = i;} @@ -165,7 +165,7 @@ APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, apr_t return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, +APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, apr_os_threadkey_t *thekey, apr_pool_t *pool) { if (pool == NULL) { diff --git a/threadproc/beos/threadproc_common.c b/threadproc/beos/threadproc_common.c index 95e162544..14d40e658 100644 --- a/threadproc/beos/threadproc_common.c +++ b/threadproc/beos/threadproc_common.c @@ -18,4 +18,4 @@ code duplication */ #include "../unix/signals.c" #include "../unix/procsup.c" - + diff --git a/threadproc/netware/proc.c b/threadproc/netware/proc.c index 06baea3ad..607ac2e48 100644 --- a/threadproc/netware/proc.c +++ b/threadproc/netware/proc.c @@ -65,7 +65,7 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, if ((in != APR_NO_PIPE) && (in != APR_NO_FILE)) { /* APR_CHILD_BLOCK maps to APR_WRITE_BLOCK, while - * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose + * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose * the CHILD/PARENT blocking flags for the stdin pipe. * stdout/stderr map to the correct mode by default. */ @@ -158,7 +158,7 @@ APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_f rv = apr_file_inherit_set(attr->child_out); } } - + if (parent_out != NULL && rv == APR_SUCCESS) { rv = apr_file_dup(&attr->parent_out, parent_out, attr->pool); } @@ -188,7 +188,7 @@ APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_f rv = apr_file_inherit_set(attr->child_err); } } - + if (parent_err != NULL && rv == APR_SUCCESS) { rv = apr_file_dup(&attr->parent_err, parent_err, attr->pool); } @@ -197,21 +197,21 @@ APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_f } -APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, - const char *dir) +APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, + const char *dir) { - return apr_filepath_merge(&attr->currdir, NULL, dir, + return apr_filepath_merge(&attr->currdir, NULL, dir, APR_FILEPATH_NATIVE, attr->pool); } APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd) + apr_cmdtype_e cmd) { /* won't ever be called on this platform, so don't save the function pointer */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach) +APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; @@ -221,7 +221,7 @@ APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int3 APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) { int pid; - + if ((pid = fork()) < 0) { return errno; } @@ -230,15 +230,15 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) apr_thread_current_after_fork(); #endif proc->pid = pid; - proc->in = NULL; - proc->out = NULL; - proc->err = NULL; + proc->in = NULL; + proc->out = NULL; + proc->err = NULL; return APR_INCHILD; } proc->pid = pid; - proc->in = NULL; - proc->out = NULL; - proc->err = NULL; + proc->in = NULL; + proc->out = NULL; + proc->err = NULL; return APR_INPARENT; } #endif @@ -310,25 +310,25 @@ APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, } APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc, - const char *progname, - const char * const *args, + const char *progname, + const char * const *args, const char * const *env, - apr_procattr_t *attr, + apr_procattr_t *attr, apr_pool_t *pool) { wiring_t wire; int addr_space; - wire.infd = attr->child_in - ? (attr->child_in->filedes != -1 ? attr->child_in->filedes + wire.infd = attr->child_in + ? (attr->child_in->filedes != -1 ? attr->child_in->filedes : FD_UNUSED) : fileno(stdin); wire.outfd = attr->child_out - ? (attr->child_out->filedes != -1 ? attr->child_out->filedes + ? (attr->child_out->filedes != -1 ? attr->child_out->filedes : FD_UNUSED) : fileno(stdout); wire.errfd = attr->child_err - ? (attr->child_err->filedes != -1 ? attr->child_err->filedes + ? (attr->child_err->filedes != -1 ? attr->child_err->filedes : FD_UNUSED) : fileno(stderr); @@ -346,30 +346,30 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc, char *fullpath = NULL; apr_status_t rv; - if ((rv = apr_filepath_merge(&fullpath, attr->currdir, progname, + if ((rv = apr_filepath_merge(&fullpath, attr->currdir, progname, APR_FILEPATH_NATIVE, pool)) != APR_SUCCESS) { return rv; } progname = fullpath; - } + } - if ((newproc->pid = procve(progname, addr_space, (const char**)env, &wire, + if ((newproc->pid = procve(progname, addr_space, (const char**)env, &wire, NULL, NULL, 0, NULL, (const char **)args)) == -1) { return errno; } if (attr->child_in && (attr->child_in->filedes != -1)) { - apr_pool_cleanup_kill(apr_file_pool_get(attr->child_in), + apr_pool_cleanup_kill(apr_file_pool_get(attr->child_in), attr->child_in, apr_unix_file_cleanup); apr_file_close(attr->child_in); } if (attr->child_out && (attr->child_out->filedes != -1)) { - apr_pool_cleanup_kill(apr_file_pool_get(attr->child_out), + apr_pool_cleanup_kill(apr_file_pool_get(attr->child_out), attr->child_out, apr_unix_file_cleanup); apr_file_close(attr->child_out); } if (attr->child_err && (attr->child_err->filedes != -1)) { - apr_pool_cleanup_kill(apr_file_pool_get(attr->child_err), + apr_pool_cleanup_kill(apr_file_pool_get(attr->child_err), attr->child_err, apr_unix_file_cleanup); apr_file_close(attr->child_err); } @@ -412,13 +412,13 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, waitpid_options |= WNOHANG; } - /* If the pid is 0 then the process was started detached. There - is no need to wait since there is nothing to wait for on a + /* If the pid is 0 then the process was started detached. There + is no need to wait since there is nothing to wait for on a detached process. Starting a process as non-detached and then calling wait or waitpid could cause the thread to hang. - The reason for this is because NetWare does not have a way - to kill or even signal a process to be killed. Starting - all processes as detached avoids the possibility of a + The reason for this is because NetWare does not have a way + to kill or even signal a process to be killed. Starting + all processes as detached avoids the possibility of a thread hanging. */ if (proc->pid == 0) { *exitwhy = APR_PROC_EXIT; @@ -453,7 +453,7 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, #if APR_HAVE_STRUCT_RLIMIT APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, - apr_int32_t what, + apr_int32_t what, struct rlimit *limit) { switch(what) { @@ -491,10 +491,10 @@ APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, } return APR_SUCCESS; -} +} #endif /* APR_HAVE_STRUCT_RLIMIT */ -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, const char *username, const char *password) { diff --git a/threadproc/netware/thread.c b/threadproc/netware/thread.c index f91957b2f..8d3bfd2b0 100644 --- a/threadproc/netware/thread.c +++ b/threadproc/netware/thread.c @@ -24,7 +24,7 @@ static int thread_count = 0; apr_status_t apr_threadattr_create(apr_threadattr_t **new, apr_pool_t *pool) { - (*new) = (apr_threadattr_t *)apr_palloc(pool, + (*new) = (apr_threadattr_t *)apr_palloc(pool, sizeof(apr_threadattr_t)); if ((*new) == NULL) { @@ -41,7 +41,7 @@ apr_status_t apr_threadattr_create(apr_threadattr_t **new, apr_status_t apr_threadattr_detach_set(apr_threadattr_t *attr,apr_int32_t on) { attr->detach = on; - return APR_SUCCESS; + return APR_SUCCESS; } apr_status_t apr_threadattr_detach_get(apr_threadattr_t *attr) @@ -64,7 +64,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, +APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, apr_size_t size) { attr->max_free = size; @@ -265,7 +265,7 @@ void apr_thread_exit(apr_thread_t *thd, apr_status_t retval) apr_status_t apr_thread_join(apr_status_t *retval, apr_thread_t *thd) { - apr_status_t stat; + apr_status_t stat; NXThreadId_t dthr; if (thd->detached) { diff --git a/threadproc/netware/threadpriv.c b/threadproc/netware/threadpriv.c index a908f4eb2..3538559ec 100644 --- a/threadproc/netware/threadpriv.c +++ b/threadproc/netware/threadpriv.c @@ -17,11 +17,11 @@ #include "apr_portable.h" #include "apr_arch_threadproc.h" -apr_status_t apr_threadkey_private_create(apr_threadkey_t **key, - void (*dest)(void *), apr_pool_t *pool) +apr_status_t apr_threadkey_private_create(apr_threadkey_t **key, + void (*dest)(void *), apr_pool_t *pool) { apr_status_t stat; - + (*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t)); if ((*key) == NULL) { return APR_ENOMEM; @@ -38,12 +38,12 @@ apr_status_t apr_threadkey_private_create(apr_threadkey_t **key, apr_status_t apr_threadkey_private_get(void **new, apr_threadkey_t *key) { apr_status_t stat; - + if ((stat = NXKeyGetValue(key->key, new)) == 0) { return APR_SUCCESS; } else { - return stat; + return stat; } } @@ -62,7 +62,7 @@ apr_status_t apr_threadkey_private_delete(apr_threadkey_t *key) { apr_status_t stat; if ((stat = NXKeyDelete(key->key)) == 0) { - return APR_SUCCESS; + return APR_SUCCESS; } return stat; } @@ -86,7 +86,7 @@ apr_status_t apr_os_threadkey_get(apr_os_threadkey_t *thekey, return APR_SUCCESS; } -apr_status_t apr_os_threadkey_put(apr_threadkey_t **key, +apr_status_t apr_os_threadkey_put(apr_threadkey_t **key, apr_os_threadkey_t *thekey, apr_pool_t *pool) { if (pool == NULL) { @@ -98,5 +98,5 @@ apr_status_t apr_os_threadkey_put(apr_threadkey_t **key, } (*key)->key = *thekey; return APR_SUCCESS; -} +} diff --git a/threadproc/os2/proc.c b/threadproc/os2/proc.c index 3f024f18d..ebff5dfb9 100644 --- a/threadproc/os2/proc.c +++ b/threadproc/os2/proc.c @@ -41,7 +41,7 @@ static apr_file_t no_file = { NULL, -1, }; APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t *pool) { - (*new) = (apr_procattr_t *)apr_palloc(pool, + (*new) = (apr_procattr_t *)apr_palloc(pool, sizeof(apr_procattr_t)); if ((*new) == NULL) { @@ -54,7 +54,7 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t * (*new)->child_out = NULL; (*new)->parent_err = NULL; (*new)->child_err = NULL; - (*new)->currdir = NULL; + (*new)->currdir = NULL; (*new)->cmdtype = APR_PROGRAM; (*new)->detached = FALSE; return APR_SUCCESS; @@ -69,7 +69,7 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, if ((in != APR_NO_PIPE) && (in != APR_NO_FILE)) { /* APR_CHILD_BLOCK maps to APR_WRITE_BLOCK, while - * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose + * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose * the CHILD/PARENT blocking flags for the stdin pipe. * stdout/stderr map to the correct mode by default. */ @@ -160,7 +160,7 @@ APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_f rv = apr_file_inherit_set(attr->child_out); } } - + if (parent_out != NULL && rv == APR_SUCCESS) { rv = apr_file_dup(&attr->parent_out, parent_out, attr->pool); } @@ -189,7 +189,7 @@ APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_f rv = apr_file_inherit_set(attr->child_err); } } - + if (parent_err != NULL && rv == APR_SUCCESS) { rv = apr_file_dup(&attr->parent_err, parent_err, attr->pool); } @@ -207,13 +207,13 @@ APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, const char } APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd) + apr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach) +APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; @@ -222,7 +222,7 @@ APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int3 APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) { int pid; - + if ((pid = fork()) < 0) { return errno; } @@ -231,15 +231,15 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) apr_thread_current_after_fork(); #endif proc->pid = pid; - proc->in = NULL; - proc->out = NULL; - proc->err = NULL; + proc->in = NULL; + proc->out = NULL; + proc->err = NULL; return APR_INCHILD; } proc->pid = pid; - proc->in = NULL; - proc->out = NULL; - proc->err = NULL; + proc->in = NULL; + proc->out = NULL; + proc->err = NULL; return APR_INPARENT; } @@ -253,20 +253,20 @@ static char *double_quotes(apr_pool_t *pool, const char *str) int num_quotes = 0; int len = 0; char *quote_doubled_str, *dest; - + while (str[len]) { num_quotes += str[len++] == '\"'; } - + quote_doubled_str = apr_palloc(pool, len + num_quotes + 1); dest = quote_doubled_str; - + while (*str) { if (*str == '\"') *(dest++) = '\"'; *(dest++) = *(str++); } - + *dest = 0; return quote_doubled_str; } @@ -336,7 +336,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname else DosDupHandle(attr->child_in->filedes, &dup); } - + if (attr->child_out) { save_out = -1; DosDupHandle(STDOUT_FILENO, &save_out); @@ -346,7 +346,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname else DosDupHandle(attr->child_out->filedes, &dup); } - + if (attr->child_err) { save_err = -1; DosDupHandle(STDERR_FILENO, &save_err); @@ -361,7 +361,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname if (attr->currdir != NULL) { _getcwd2(savedir, sizeof(savedir)); - + if (_chdir2(attr->currdir) < 0) { if (criticalsection) DosExitCritSec(); @@ -516,7 +516,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname DosDupHandle(save_in, &dup); DosClose(save_in); } - + if (attr->child_out) { if (attr->child_out->filedes != -1) { apr_file_close(attr->child_out); @@ -526,7 +526,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname DosDupHandle(save_out, &dup); DosClose(save_out); } - + if (attr->child_err) { if (attr->child_err->filedes != -1) { apr_file_close(attr->child_err); @@ -545,8 +545,8 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname -static void proces_result_codes(RESULTCODES codes, - int *exitcode, +static void proces_result_codes(RESULTCODES codes, + int *exitcode, apr_exit_why_e *exitwhy) { int result = 0; @@ -624,7 +624,7 @@ APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, } return APR_FROM_OS_ERROR(rc); -} +} @@ -645,7 +645,7 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, } return APR_FROM_OS_ERROR(rc); -} +} @@ -654,7 +654,7 @@ APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize) return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, const char *username, const char *password) { diff --git a/threadproc/os2/thread.c b/threadproc/os2/thread.c index 2756baf28..32acb3704 100644 --- a/threadproc/os2/thread.c +++ b/threadproc/os2/thread.c @@ -68,7 +68,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, +APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, apr_size_t size) { attr->max_free = size; @@ -278,7 +278,7 @@ APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, apr_thread -APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd, +APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd, apr_pool_t *pool) { if ((*thd) == NULL) { @@ -348,7 +348,7 @@ APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, -APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, +APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, void (*func)(void)) { if (!control->hit) { diff --git a/threadproc/os2/threadpriv.c b/threadproc/os2/threadpriv.c index c0f709c31..36a05bc6a 100644 --- a/threadproc/os2/threadpriv.c +++ b/threadproc/os2/threadpriv.c @@ -23,7 +23,7 @@ #include "apr_arch_file_io.h" APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, - void (*dest)(void *), + void (*dest)(void *), apr_pool_t *pool) { (*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t)); @@ -72,8 +72,8 @@ APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, apr_t return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, - apr_os_threadkey_t *thekey, +APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, + apr_os_threadkey_t *thekey, apr_pool_t *pool) { if (pool == NULL) { @@ -85,4 +85,4 @@ APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, } (*key)->key = *thekey; return APR_SUCCESS; -} +} diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c index ee05e147d..695c621ec 100644 --- a/threadproc/unix/proc.c +++ b/threadproc/unix/proc.c @@ -49,7 +49,7 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, if ((in != APR_NO_PIPE) && (in != APR_NO_FILE)) { /* APR_CHILD_BLOCK maps to APR_WRITE_BLOCK, while - * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose + * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose * the CHILD/PARENT blocking flags for the stdin pipe. * stdout/stderr map to the correct mode by default. */ @@ -220,7 +220,7 @@ APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) { int pid; - + memset(proc, 0, sizeof(apr_proc_t)); /* Rekey PRNG(s) to clear buffer(s) and make sure that the @@ -343,7 +343,7 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, attr->uid = -1; return rv; } - + /* Use default user group if not already set */ if (attr->gid == -1) { attr->gid = gid; @@ -548,7 +548,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, default: { char *ch, *onearg; - + ch = onearg = apr_palloc(pool, onearg_len); i = 0; while (args[i]) { diff --git a/threadproc/unix/signals.c b/threadproc/unix/signals.c index 9a83c124c..061d3dc6f 100644 --- a/threadproc/unix/signals.c +++ b/threadproc/unix/signals.c @@ -85,7 +85,7 @@ APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func) /* XXX jeff thinks this should be enabled whenever SA_NOCLDWAIT is defined */ /* this is required on Tru64 to cause child processes to - * disappear gracefully - XPG4 compatible + * disappear gracefully - XPG4 compatible */ if ((signo == SIGCHLD) && (func == SIG_IGN)) { act.sa_flags |= SA_NOCLDWAIT; @@ -93,7 +93,7 @@ APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func) #endif #if defined(__NetBSD__) || defined(DARWIN) /* ignoring SIGCHLD or leaving the default disposition doesn't avoid zombies, - * and there is no SA_NOCLDWAIT flag, so catch the signal and reap status in + * and there is no SA_NOCLDWAIT flag, so catch the signal and reap status in * the handler to avoid zombies */ if ((signo == SIGCHLD) && (func == SIG_IGN)) { @@ -321,7 +321,7 @@ APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum)) sigfillset(&sig_mask); /* On certain platforms, sigwait() returns EINVAL if any of various - * unblockable signals are included in the mask. This was first + * unblockable signals are included in the mask. This was first * observed on AIX and Tru64. */ #ifdef SIGKILL @@ -378,7 +378,7 @@ APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum)) { /* handle sigwait() error here */ } - + if (sig_func(signal_received) == 1) { return APR_SUCCESS; } @@ -401,7 +401,7 @@ APR_DECLARE(apr_status_t) apr_setup_signal_thread(void) * No thread should ever block synchronous signals. * See the Solaris man page for pthread_sigmask() for * some information. Solaris chooses to knock out such - * processes when a blocked synchronous signal is + * processes when a blocked synchronous signal is * delivered, skipping any registered signal handler. * AIX doesn't call a signal handler either. At least * one level of linux+glibc does call the handler even diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c index 68b14db3c..d90d05f46 100644 --- a/threadproc/unix/thread.c +++ b/threadproc/unix/thread.c @@ -73,7 +73,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, if ((stat = pthread_attr_setdetachstate(&attr->attr, &arg)) == 0) { #else - if ((stat = pthread_attr_setdetachstate(&attr->attr, + if ((stat = pthread_attr_setdetachstate(&attr->attr, DETACH_ARG(on))) == 0) { #endif return APR_SUCCESS; @@ -136,7 +136,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, #endif } -APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, +APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, apr_size_t size) { attr->max_free = size; diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index a1d201ce8..38e09ad6f 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -45,7 +45,7 @@ static apr_file_t no_file = { NULL, INVALID_HANDLE_VALUE, }; #define LOGON32_LOGON_NETWORK 3 #endif -/* +/* * some of the ideas expressed herein are based off of Microsoft * Knowledge Base article: Q190351 * @@ -60,7 +60,7 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, } APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, - apr_int32_t in, + apr_int32_t in, apr_int32_t out, apr_int32_t err) { @@ -68,7 +68,7 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, if (in) { /* APR_CHILD_BLOCK maps to APR_WRITE_BLOCK, while - * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose + * APR_PARENT_BLOCK maps to APR_READ_BLOCK, so transpose * the CHILD/PARENT blocking flags for the stdin pipe. * stdout/stderr map to the correct mode by default. */ @@ -79,7 +79,7 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, if (in == APR_NO_FILE) attr->child_in = &no_file; - else { + else { stat = apr_file_pipe_create_ex(&attr->child_in, &attr->parent_in, in, attr->pool); } @@ -89,7 +89,7 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, if (out && stat == APR_SUCCESS) { if (out == APR_NO_FILE) attr->child_out = &no_file; - else { + else { stat = apr_file_pipe_create_ex(&attr->parent_out, &attr->child_out, out, attr->pool); } @@ -99,7 +99,7 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, if (err && stat == APR_SUCCESS) { if (err == APR_NO_FILE) attr->child_err = &no_file; - else { + else { stat = apr_file_pipe_create_ex(&attr->parent_err, &attr->child_err, err, attr->pool); } @@ -109,8 +109,8 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, return stat; } -APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, - apr_file_t *child_in, +APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, + apr_file_t *child_in, apr_file_t *parent_in) { apr_status_t rv = APR_SUCCESS; @@ -188,24 +188,24 @@ APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, } APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, - const char *dir) + const char *dir) { /* curr dir must be in native format, there are all sorts of bugs in * the NT library loading code that flunk the '/' parsing test. */ - return apr_filepath_merge(&attr->currdir, NULL, dir, + return apr_filepath_merge(&attr->currdir, NULL, dir, APR_FILEPATH_NATIVE, attr->pool); } APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd) + apr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, - apr_int32_t det) + apr_int32_t det) { attr->detached = det; return APR_SUCCESS; @@ -213,14 +213,14 @@ APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, static apr_status_t attr_cleanup(void *theattr) { - apr_procattr_t *attr = (apr_procattr_t *)theattr; + apr_procattr_t *attr = (apr_procattr_t *)theattr; if (attr->user_token) CloseHandle(attr->user_token); attr->user_token = NULL; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, const char *username, const char *password) { @@ -230,14 +230,14 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, apr_status_t rv; apr_size_t len, wlen; - if (apr_os_level >= APR_WIN_NT_4) + if (apr_os_level >= APR_WIN_NT_4) { if (attr->user_token) { /* Cannot set that twice */ if (attr->errfn) { - attr->errfn(attr->pool, 0, - apr_pstrcat(attr->pool, - "function called twice" + attr->errfn(attr->pool, 0, + apr_pstrcat(attr->pool, + "function called twice" " on username: ", username, NULL)); } return APR_EINVAL; @@ -248,8 +248,8 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, if ((rv = apr_conv_utf8_to_utf16(username, &len, wusername, &wlen)) != APR_SUCCESS) { if (attr->errfn) { - attr->errfn(attr->pool, rv, - apr_pstrcat(attr->pool, "utf8 to utf16 conversion failed" + attr->errfn(attr->pool, rv, + apr_pstrcat(attr->pool, "utf8 to utf16 conversion failed" " on username: ", username, NULL)); } return rv; @@ -261,26 +261,26 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, if ((rv = apr_conv_utf8_to_utf16(password, &len, wpassword, &wlen)) != APR_SUCCESS) { if (attr->errfn) { - attr->errfn(attr->pool, rv, "utf8 to utf16 conversion" + attr->errfn(attr->pool, rv, "utf8 to utf16 conversion" " failed on password: "); } return rv; } } - if (!LogonUserW(wusername, - NULL, + if (!LogonUserW(wusername, + NULL, wpassword ? wpassword : L"", LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &user)) { - /* Logon Failed */ + /* Logon Failed */ return apr_get_os_error(); } if (wpassword) memset(wpassword, 0, wlen * sizeof(apr_wchar_t)); /* Get the primary token for user */ - if (!DuplicateTokenEx(user, - TOKEN_QUERY | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY, + if (!DuplicateTokenEx(user, + TOKEN_QUERY | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY, NULL, SecurityImpersonation, TokenPrimary, @@ -424,7 +424,7 @@ static char *apr_caret_escape_args(apr_pool_t *p, const char *str) s = (const unsigned char *)str; for (; *s; ++s) { - /* + /* * Newlines to Win32/OS2 CreateProcess() are ill advised. * Convert them to spaces since they are effectively white * space to most applications @@ -519,14 +519,14 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, * not manage the stdio handles properly when running old 16 * bit executables if the detached attribute is set. */ - /* - * XXX DETACHED_PROCESS won't on Win9x at all; on NT/W2K + /* + * XXX DETACHED_PROCESS won't on Win9x at all; on NT/W2K * 16 bit executables fail (MS KB: Q150956) */ dwCreationFlags |= DETACHED_PROCESS; } - /* progname must be unquoted, in native format, as there are all sorts + /* progname must be unquoted, in native format, as there are all sorts * of bugs in the NT library loader code that fault when parsing '/'. * XXX progname must be NULL if this is a 16 bit app running in WOW */ @@ -536,18 +536,18 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if (attr->cmdtype == APR_PROGRAM || attr->cmdtype == APR_PROGRAM_ENV) { char *fullpath = NULL; - if ((rv = apr_filepath_merge(&fullpath, attr->currdir, progname, + 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, + attr->errfn(pool, rv, + apr_pstrcat(pool, "filepath_merge failed.", + " currdir: ", attr->currdir, " progname: ", progname, NULL)); } return rv; } progname = fullpath; - } + } else { /* Do not fail if the path isn't parseable for APR_PROGRAM_PATH * or APR_SHELLCMD. We only invoke apr_filepath_merge (with no @@ -557,10 +557,10 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, * built-in shell command.) */ char *fullpath = NULL; - if ((rv = apr_filepath_merge(&fullpath, "", progname, + if ((rv = apr_filepath_merge(&fullpath, "", progname, APR_FILEPATH_NATIVE, pool)) == APR_SUCCESS) { progname = fullpath; - } + } } if (has_space(progname)) { @@ -600,8 +600,8 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } cmdline = apr_pstrcat(pool, shellcmd, " /C \"", argv0, cmdline, "\"", NULL); - } - else + } + else { /* Win32 is _different_ than unix. While unix will find the given * program since it's already chdir'ed, Win32 cannot since the parent @@ -645,7 +645,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, * is not a shellcmd, and the source of argv[] is untrusted. * Notice we escape ALL the cmdline args, including the quotes * around the individual args themselves. No sense in allowing - * the shift-state to be toggled, and the application will + * the shift-state to be toggled, and the application will * not see the caret escapes. */ cmdline = apr_caret_escape_args(pool, cmdline); @@ -690,14 +690,14 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, * Win32's CreateProcess call requires that the environment * be passed in an environment block, a null terminated block of * null terminated strings. - */ + */ i = 0; iEnvBlockLen = 1; while (env[i]) { iEnvBlockLen += strlen(env[i]) + 1; i++; } - if (!i) + if (!i) ++iEnvBlockLen; { @@ -709,12 +709,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, pNext = (apr_wchar_t*)pEnvBlock; while (env[i]) { apr_size_t in = strlen(env[i]) + 1; - if ((rv = apr_conv_utf8_to_utf16(env[i], &in, - pNext, &iEnvBlockLen)) + if ((rv = apr_conv_utf8_to_utf16(env[i], &in, + pNext, &iEnvBlockLen)) != APR_SUCCESS) { if (attr->errfn) { - attr->errfn(pool, rv, - apr_pstrcat(pool, "utf8 to utf16 conversion failed" + attr->errfn(pool, rv, + apr_pstrcat(pool, "utf8 to utf16 conversion failed" " on this string: ", env[i], NULL)); } return rv; @@ -726,7 +726,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, *(pNext++) = L'\0'; *pNext = L'\0'; } - } + } new->invoked = cmdline; @@ -746,8 +746,8 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if ((rv = apr_conv_utf8_to_utf16(progname, &nprg, wprg, &nwprg)) != APR_SUCCESS) { if (attr->errfn) { - attr->errfn(pool, rv, - apr_pstrcat(pool, "utf8 to utf16 conversion failed" + attr->errfn(pool, rv, + apr_pstrcat(pool, "utf8 to utf16 conversion failed" " on progname: ", progname, NULL)); } return rv; @@ -761,8 +761,8 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if ((rv = apr_conv_utf8_to_utf16(cmdline, &ncmd, wcmd, &nwcmd)) != APR_SUCCESS) { if (attr->errfn) { - attr->errfn(pool, rv, - apr_pstrcat(pool, "utf8 to utf16 conversion failed" + attr->errfn(pool, rv, + apr_pstrcat(pool, "utf8 to utf16 conversion failed" " on cmdline: ", cmdline, NULL)); } return rv; @@ -774,12 +774,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, apr_size_t ncwd = strlen(attr->currdir) + 1; apr_size_t nwcwd = ncwd; wcwd = apr_palloc(pool, ncwd * sizeof(wcwd[0])); - if ((rv = apr_conv_utf8_to_utf16(attr->currdir, &ncwd, + if ((rv = apr_conv_utf8_to_utf16(attr->currdir, &ncwd, wcwd, &nwcwd)) != APR_SUCCESS) { if (attr->errfn) { - attr->errfn(pool, rv, - apr_pstrcat(pool, "utf8 to utf16 conversion failed" + attr->errfn(pool, rv, + apr_pstrcat(pool, "utf8 to utf16 conversion failed" " on currdir: ", attr->currdir, NULL)); } return rv; @@ -794,7 +794,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, si.wShowWindow = SW_HIDE; } - /* LOCK CRITICAL SECTION + /* LOCK CRITICAL SECTION * before we begin to manipulate the inherited handles */ EnterCriticalSection(&proc_lock); @@ -814,12 +814,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, SetHandleInformation(si.hStdInput, HANDLE_FLAG_INHERIT, 0); - if ( (si.hStdInput = attr->child_in->filehand) + if ( (si.hStdInput = attr->child_in->filehand) != INVALID_HANDLE_VALUE ) SetHandleInformation(si.hStdInput, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); } - + si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); if (attr->child_out && attr->child_out->filehand) { @@ -829,7 +829,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, SetHandleInformation(si.hStdOutput, HANDLE_FLAG_INHERIT, 0); - if ( (si.hStdOutput = attr->child_out->filehand) + if ( (si.hStdOutput = attr->child_out->filehand) != INVALID_HANDLE_VALUE ) SetHandleInformation(si.hStdOutput, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); @@ -844,7 +844,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, SetHandleInformation(si.hStdError, HANDLE_FLAG_INHERIT, 0); - if ( (si.hStdError = attr->child_err->filehand) + if ( (si.hStdError = attr->child_err->filehand) != INVALID_HANDLE_VALUE ) SetHandleInformation(si.hStdError, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); @@ -852,7 +852,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } if (attr->user_token) { /* XXX: for terminal services, handles can't be cannot be - * inherited across sessions. This process must be created + * inherited across sessions. This process must be created * in our existing session. lpDesktop assignment appears * to be wrong according to these rules. */ @@ -903,14 +903,14 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, SetHandleInformation(GetStdHandle(STD_ERROR_HANDLE), stderr_reset, stderr_reset); } - /* RELEASE CRITICAL SECTION + /* RELEASE CRITICAL SECTION * The state of the inherited handles has been restored. */ LeaveCriticalSection(&proc_lock); } - /* Check CreateProcess result + /* Check CreateProcess result */ if (!rv) return apr_get_os_error(); @@ -938,7 +938,7 @@ static apr_exit_why_e why_from_exit_code(DWORD exit) { /* See WinNT.h STATUS_ACCESS_VIOLATION and family for how * this class of failures was determined */ - if (((exit & 0xC0000000) == 0xC0000000) + if (((exit & 0xC0000000) == 0xC0000000) && !(exit & 0x3FFF0000)) return APR_PROC_SIGNAL; else @@ -993,7 +993,7 @@ APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, else CloseHandle(hProcess); } - else { + else { /* Process has exited. * No need to wait for its termination. */ diff --git a/threadproc/win32/signals.c b/threadproc/win32/signals.c index 48676d856..15733622a 100644 --- a/threadproc/win32/signals.c +++ b/threadproc/win32/signals.c @@ -28,9 +28,9 @@ #include #endif -/* Windows only really support killing process, but that will do for now. +/* Windows only really support killing process, but that will do for now. * - * ### Actually, closing the input handle to the proc should also do fine + * ### Actually, closing the input handle to the proc should also do fine * for most console apps. This definitely needs improvement... */ APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signal) @@ -39,7 +39,7 @@ APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signal) if (TerminateProcess(proc->hproc, signal) == 0) { return apr_get_os_error(); } - /* On unix, SIGKILL leaves a apr_proc_wait()able pid lying around, + /* On unix, SIGKILL leaves a apr_proc_wait()able pid lying around, * so we will leave hproc alone until the app calls apr_proc_wait(). */ return APR_SUCCESS; diff --git a/threadproc/win32/thread.c b/threadproc/win32/thread.c index 7ae7ca062..9d1a0f5d3 100644 --- a/threadproc/win32/thread.c +++ b/threadproc/win32/thread.c @@ -23,7 +23,7 @@ #ifdef HAVE_PROCESS_H #include #endif -#include "apr_arch_misc.h" +#include "apr_arch_misc.h" /* Chosen for us by apr_initialize */ DWORD tls_apr_thread = 0; @@ -31,7 +31,7 @@ DWORD tls_apr_thread = 0; APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool_t *pool) { - (*new) = (apr_threadattr_t *)apr_palloc(pool, + (*new) = (apr_threadattr_t *)apr_palloc(pool, sizeof(apr_threadattr_t)); if ((*new) == NULL) { @@ -72,7 +72,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, +APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr, apr_size_t size) { attr->max_free = size; @@ -238,7 +238,7 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, { apr_status_t rv = APR_SUCCESS; DWORD ret; - + if (!thd->td) { /* Can not join on detached threads */ return APR_DETACH; @@ -312,11 +312,11 @@ APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void) if (hthread) { return hthread; } - + hproc = GetCurrentProcess(); hthread = GetCurrentThread(); - if (!DuplicateHandle(hproc, hthread, - hproc, &hthread, 0, FALSE, + if (!DuplicateHandle(hproc, hthread, + hproc, &hthread, 0, FALSE, DUPLICATE_SAME_ACCESS)) { return NULL; } diff --git a/threadproc/win32/threadpriv.c b/threadproc/win32/threadpriv.c index 1cce0c667..f6d0dc2b3 100644 --- a/threadproc/win32/threadpriv.c +++ b/threadproc/win32/threadpriv.c @@ -59,7 +59,7 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key) { if (TlsFree(key->key)) { - return APR_SUCCESS; + return APR_SUCCESS; } return apr_get_os_error(); } @@ -97,5 +97,5 @@ APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, } (*key)->key = *thekey; return APR_SUCCESS; -} +} -- cgit v1.2.1