summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-11 21:53:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-03-11 21:53:04 -0700
commitd5915cf610b71691a95f5af3fe09848adb3f0d3d (patch)
treeecfed5d46a7c2925ed8d1d3e46f5468ab28f603e
parent1fb002a4fd466e2384d12b80176a1bf526d0ce5f (diff)
downloadtxr-d5915cf610b71691a95f5af3fe09848adb3f0d3d.tar.gz
txr-d5915cf610b71691a95f5af3fe09848adb3f0d3d.tar.bz2
txr-d5915cf610b71691a95f5af3fe09848adb3f0d3d.zip
* stream.c (open_process): In the event of fdopen failure,
kill the child process less abruptly by hitting it with SIGINT and SIGTERM, rather than with SIGKILL. Also, collect the child process with waitpid.
-rw-r--r--ChangeLog7
-rw-r--r--stream.c6
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ceb25b20..ad9e6096 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2014-03-11 Kaz Kylheku <kaz@kylheku.com>
+ * stream.c (open_process): In the event of fdopen failure,
+ kill the child process less abruptly by hitting it with SIGINT and
+ SIGTERM, rather than with SIGKILL. Also, collect the child
+ process with waitpid.
+
+2014-03-11 Kaz Kylheku <kaz@kylheku.com>
+
* eval.c (eval_init): Registration of url_encode and url_decode
moved to filter.c.
diff --git a/stream.c b/stream.c
index dbe3e9ff..da58e38d 100644
--- a/stream.c
+++ b/stream.c
@@ -2188,7 +2188,11 @@ val open_process(val name, val mode_str, val args)
free(argv);
if ((f = fdopen(whichfd, utf8mode)) == 0) {
- kill(pid, SIGKILL);
+ int status;
+ kill(pid, SIGINT);
+ kill(pid, SIGTERM);
+ while (waitpid(pid, &status, 0) == -1 && errno == EINTR)
+ ;
free(utf8mode);
uw_throwf(file_error_s, lit("opening pipe ~a, fdopen failed: ~a/~s"),
name, num(errno), string_utf8(strerror(errno)), nao);