summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-19 20:58:56 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-19 20:58:56 -0700
commit7c34d91f30e5a77bc12b811f6c836cea71905529 (patch)
treefc258b1dfe2bba95bc2b8efb78a48a2d5f5a7f8b /stream.c
parent36232eb7e1323832df24031957e647ca8675a2e9 (diff)
downloadtxr-7c34d91f30e5a77bc12b811f6c836cea71905529.tar.gz
txr-7c34d91f30e5a77bc12b811f6c836cea71905529.tar.bz2
txr-7c34d91f30e5a77bc12b811f6c836cea71905529.zip
streams: pipe streams not needed if we have fork.
* stream.c (se_pclose, make_pipe_stream): define only if !HAVE_FORK_STUFF. (pipe_close): Don't call se_pclose in HAVE_FORK_STUFF build. The pipe_ops are no longer shared between popen pipes and open-process pipes. * stream.h (make_pipe_stream): Conditionally declare.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/stream.c b/stream.c
index 1c61873b..c38df097 100644
--- a/stream.c
+++ b/stream.c
@@ -1342,8 +1342,7 @@ static int pipevp_close(FILE *f, pid_t pid)
sig_restore_enable;
return status;
}
-#endif
-
+#else
static int se_pclose(FILE *f)
{
int ret;
@@ -1352,6 +1351,7 @@ static int se_pclose(FILE *f)
sig_restore_enable;
return ret;
}
+#endif
static val pipe_close(val stream, val throw_on_error)
{
@@ -1359,7 +1359,7 @@ static val pipe_close(val stream, val throw_on_error)
if (h->f != 0) {
#if HAVE_FORK_STUFF
- int status = h->pid != 0 ? pipevp_close(h->f, h->pid) : se_pclose(h->f);
+ int status = pipevp_close(h->f, h->pid);
#else
int status = se_pclose(h->f);
#endif
@@ -1706,10 +1706,12 @@ val make_tail_stream(FILE *f, val descr)
return stream;
}
+#if !HAVE_FORK_STUFF
val make_pipe_stream(FILE *f, val descr)
{
return make_stdio_stream_common(f, descr, &pipe_ops.cobj_ops);
}
+#endif
#if HAVE_SOCKETS
val make_sock_stream(FILE *f, val family, val type)