dreid 99/11/04 03:21:53
Modified: src/lib/apr/threadproc/beos apr_proc_stub.c
Log:
Now that CGI works tidy up the files that support it.
Revision Changes Path
1.4 +7 -17 apache-2.0/src/lib/apr/threadproc/beos/apr_proc_stub.c
Index: apr_proc_stub.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/beos/apr_proc_stub.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apr_proc_stub.c 1999/10/22 22:06:16 1.3
+++ apr_proc_stub.c 1999/11/04 11:21:52 1.4
@@ -7,7 +7,6 @@
int in;
int out;
int err;
- char ** envp;
};
int main(int argc, char *argv[]) {
@@ -23,15 +22,9 @@
struct pipefd *pfd;
thread_id sender;
void *buffer;
- int indes[2];
- int outdes[2];
- int errdes[2];
char ** newargs;
int i = 0;
- char * readbuffer;
- size_t readbuf = 100;
- readbuffer = (char*)malloc(sizeof(char) * readbuf);
newargs = (char**)malloc(sizeof(char*) * (argc - 1));
buffer = (void*)malloc(sizeof(struct pipefd));
@@ -40,19 +33,16 @@
pfd = (struct pipefd*)buffer;
if (pfd->in > STDERR_FILENO) {
- if (pipe(indes) == -1)return (-1);
- if (dup2(pfd->in, indes[0]) != indes[0]) return (-1);
- if (dup2(indes[0], STDIN_FILENO) != STDIN_FILENO) return (-1);
+ if (dup2(pfd->in, STDIN_FILENO) != STDIN_FILENO) return (-1);
+ close (pfd->in);
}
if (pfd->out > STDERR_FILENO) {
- if (pipe(outdes) == -1)return (-1);
- if (dup2(pfd->out, outdes[1]) != outdes[1]) return (-1);
- if (dup2(outdes[1], STDOUT_FILENO) != STDOUT_FILENO) return
(-1);
+ if (dup2(pfd->out, STDOUT_FILENO) != STDOUT_FILENO) return (-1);
+ close (pfd->out);
}
if (pfd->err > STDERR_FILENO) {
- if (pipe(errdes) == -1)return (-1);
- if (dup2(pfd->err, errdes[1]) != errdes[1]) return (-1);
- if (dup2(errdes[1], STDERR_FILENO) != STDERR_FILENO) return
(-1);
+ if (dup2(pfd->err, STDERR_FILENO) != STDERR_FILENO) return (-1);
+ close (pfd->err);
}
for (i=3;i<=argc;i++){
@@ -64,7 +54,7 @@
if (directory != NULL)
chdir(directory);
- execve (progname, newargs, NULL);
+ execve (progname, newargs, environ);
return (-1);
}