diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-08-05 12:35:36 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-08-05 14:20:51 +0200 |
commit | 56b1ea9002d2d3967b597aa0ee7595e815b21f23 (patch) | |
tree | ca6bae53db85ebe10026c191f58bb7f1cdb91340 /libguile | |
parent | 01e960edea3f61078f172e706b2c019c01d58107 (diff) | |
download | guile-56b1ea9002d2d3967b597aa0ee7595e815b21f23.tar.gz |
'system*' can no longer close file descriptor 2.
Fixes <https://bugs.gnu.org/55596>.
Reported by Hugo Nobrega <hugonobrega@ic.ufrj.br>
and Jack Hill <jackhill@jackhill.us>.
* libguile/posix.c (start_child): Close OUT only if it's greater than 2.
* test-suite/tests/posix.test ("system*")["exit code for nonexistent file"]
["https://bugs.gnu.org/55596"]: New tests.
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/posix.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libguile/posix.c b/libguile/posix.c index 3ab12b99e..f4ca72d3e 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1,4 +1,4 @@ -/* Copyright 1995-2014,2016-2019,2021 +/* Copyright 1995-2014, 2016-2019, 2021-2022 Free Software Foundation, Inc. This file is part of Guile. @@ -1371,7 +1371,8 @@ start_child (const char *exec_file, char **exec_argv, if (err == 1) err = renumber_file_descriptor (err, err); do dup2 (out, 1); while (errno == EINTR); - close (out); + if (out > 2) + close (out); } if (err > 2) { |