diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2023-05-02 16:02:32 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2023-05-02 16:15:34 +0300 |
commit | 15874b30207fa29faf8ce9e64add011b5afa8e05 (patch) | |
tree | e0a36792cdbcdd822bcaa41fae9cf991b310f7a2 /src/directive.c | |
parent | 5ba0926fabd419e51f777f138389e3588bbd1ce9 (diff) | |
download | wydawca-master.tar.gz wydawca-master.tar.bz2 |
Diffstat (limited to 'src/directive.c')
-rw-r--r-- | src/directive.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/directive.c b/src/directive.c index e69888b..0df6611 100644 --- a/src/directive.c +++ b/src/directive.c @@ -558,10 +558,12 @@ run_check_script(const char *script, struct wy_triplet *trp, if (efd == -1) _exit(127); - for (i = getdtablesize(); i >= 0; i--) { - if (i != p[1] && i != efd) - close(i); - } + /* Select the biggest fd. */ + i = p[1]; + if (efd > i) + i = efd; + /* Close all fds above it. */ + wy_close_fds_above(i); if (p[1] != 1 && dup2(p[1], 1) != 1) { wy_log(LOG_CRIT, |