You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by dr...@apache.org on 2004/06/28 13:18:37 UTC
cvs commit: apr/threadproc/beos proc.c
dreid 2004/06/28 04:18:36
Modified: threadproc/beos proc.c
Log:
Incorporate suggested changes from Martin Kraemer and Will Rowe.
Revision Changes Path
1.53 +9 -8 apr/threadproc/beos/proc.c
Index: proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/beos/proc.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- proc.c 14 Jun 2004 17:26:19 -0000 1.52
+++ proc.c 28 Jun 2004 11:18:36 -0000 1.53
@@ -114,12 +114,10 @@
const char *dir)
{
char * cwd;
- if (strncmp("/",dir,1) != 0 ) {
+ if (dir[0] != '/') {
cwd = (char*)malloc(sizeof(char) * PATH_MAX);
getcwd(cwd, PATH_MAX);
- strncat(cwd,"/\0",2);
- strcat(cwd,dir);
- attr->currdir = (char *)apr_pstrdup(attr->pool, cwd);
+ attr->currdir = (char *)apr_pstrcat(attr->pool, cwd, "/", dir, NULL);
free(cwd);
} else {
attr->currdir = (char *)apr_pstrdup(attr->pool, dir);
@@ -154,7 +152,7 @@
proc->pid = pid;
proc->in = NULL;
proc->out = NULL;
- proc->err = NULL;
+ proc->err = NULL;
return APR_INCHILD;
}
proc->pid = pid;
@@ -188,7 +186,8 @@
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, apr_pool_t *pool)
+ apr_procattr_t *attr,
+ apr_pool_t *pool)
{
int i=0,nargs=0;
char **newargs = NULL;
@@ -239,7 +238,7 @@
free (newargs[nargs]);
free(newargs);
- if ( newproc < B_NO_ERROR) {
+ if (newproc < B_NO_ERROR) {
return errno;
}
@@ -297,7 +296,7 @@
if (waithow != APR_WAIT) {
waitpid_options |= WNOHANG;
}
-
+
if ((pstatus = waitpid(proc->pid, &exit_int, waitpid_options)) > 0) {
proc->pid = pstatus;
if (WIFEXITED(exit_int)) {
@@ -309,6 +308,7 @@
*exitcode = WTERMSIG(exit_int);
}
else {
+
/* unexpected condition */
return APR_EGENERAL;
}
@@ -317,6 +317,7 @@
else if (pstatus == 0) {
return APR_CHILD_NOTDONE;
}
+
return errno;
}