summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>1999-02-12 18:48:42 +0000
committerwtc%netscape.com <devnull@localhost>1999-02-12 18:48:42 +0000
commit3befa5c799c0d396f579696e59d39c15f99a20ab (patch)
tree36cfd7102a3359db929d0d469e203e1e3cc53b79
parentd2420100307e118a7eb5ed0c621866d62bd80c1f (diff)
downloadnspr-hg-3befa5c799c0d396f579696e59d39c15f99a20ab.tar.gz
Make sure the redirected standard I/O fd's are blocking so that
libc's stdio.h functions can work.
-rw-r--r--pr/src/md/unix/uxproces.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/pr/src/md/unix/uxproces.c b/pr/src/md/unix/uxproces.c
index 6b1d4110..3ae0f5a1 100644
--- a/pr/src/md/unix/uxproces.c
+++ b/pr/src/md/unix/uxproces.c
@@ -145,6 +145,7 @@ ForkAndExec(
int nEnv, idx;
char *const *childEnvp;
char **newEnvp = NULL;
+ int flags;
process = PR_NEW(PRProcess);
if (!process) {
@@ -200,6 +201,10 @@ ForkAndExec(
_exit(1); /* failed */
}
close(attr->stdinFd->secret->md.osfd);
+ flags = fcntl(0, F_GETFL, 0);
+ if (flags & O_NONBLOCK) {
+ fcntl(0, F_SETFL, flags & ~O_NONBLOCK);
+ }
}
if (attr->stdoutFd
&& attr->stdoutFd->secret->md.osfd != 1) {
@@ -207,6 +212,10 @@ ForkAndExec(
_exit(1); /* failed */
}
close(attr->stdoutFd->secret->md.osfd);
+ flags = fcntl(1, F_GETFL, 0);
+ if (flags & O_NONBLOCK) {
+ fcntl(1, F_SETFL, flags & ~O_NONBLOCK);
+ }
}
if (attr->stderrFd
&& attr->stderrFd->secret->md.osfd != 2) {
@@ -214,6 +223,10 @@ ForkAndExec(
_exit(1); /* failed */
}
close(attr->stderrFd->secret->md.osfd);
+ flags = fcntl(2, F_GETFL, 0);
+ if (flags & O_NONBLOCK) {
+ fcntl(2, F_SETFL, flags & ~O_NONBLOCK);
+ }
}
if (attr->currentDirectory) {
if (chdir(attr->currentDirectory) < 0) {