commit 7d4f279c042c617115658fb5653b34dc244209f8
parent f230c46e5ef3d091ef9a3a304819378bd6748b69
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 27 Oct 2019 10:34:12 +0100
tweaks: close the unused reading ends of two more output pipes
It is done for 'spell', so do it also for 'sort' and 'uniq'.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -2357,8 +2357,6 @@ const char *do_int_speller(const char *tempfile_name)
/* Fork a process to run spell in. */
if ((pid_spell = fork()) == 0) {
- close(spell_fd[0]);
-
/* Child: open the temporary file that holds the text to be checked. */
if ((tempfile_fd = open(tempfile_name, O_RDONLY)) == -1)
exit(6);
@@ -2373,6 +2371,7 @@ const char *do_int_speller(const char *tempfile_name)
if (dup2(spell_fd[1], STDOUT_FILENO) != STDOUT_FILENO)
exit(8);
+ close(spell_fd[0]);
close(spell_fd[1]);
/* Now run the spell program. */
@@ -2397,6 +2396,7 @@ const char *do_int_speller(const char *tempfile_name)
if (dup2(sort_fd[1], STDOUT_FILENO) != STDOUT_FILENO)
exit(8);
+ close(sort_fd[0]);
close(sort_fd[1]);
/* Now run the sort program. Use -f to mix upper and lower case. */
@@ -2418,6 +2418,7 @@ const char *do_int_speller(const char *tempfile_name)
if (dup2(uniq_fd[1], STDOUT_FILENO) != STDOUT_FILENO)
exit(8);
+ close(uniq_fd[0]);
close(uniq_fd[1]);
execlp("uniq", "uniq", NULL);