summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-11-12 13:11:58 -0500
committerTavian Barnes <tavianator@tavianator.com>2017-11-12 15:17:46 -0500
commit622bcf9d46a763b7aaba75fa8421533bcbe4b981 (patch)
treeb1e7bfe8f1a108f13a1bd6d8bf03c2d852a1ce09 /parse.c
parentaf7878c7474de2f6c5542ad52a0a67237387c638 (diff)
downloadbfs-622bcf9d46a763b7aaba75fa8421533bcbe4b981.tar.xz
exec: Recover from E2BIG
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index 9054af7..1fc4832 100644
--- a/parse.c
+++ b/parse.c
@@ -1105,13 +1105,17 @@ static struct expr *parse_exec(struct parser_state *state, int flags, int arg2)
expr->cost = 1000000.0;
}
+ int ephemeral_fds = 2;
if (execbuf->flags & BFS_EXEC_CHDIR) {
if (execbuf->flags & BFS_EXEC_MULTI) {
++cmdline->persistent_fds;
- } else if (cmdline->ephemeral_fds < 1) {
- cmdline->ephemeral_fds = 1;
+ } else {
+ ++ephemeral_fds;
}
}
+ if (cmdline->ephemeral_fds < ephemeral_fds) {
+ cmdline->ephemeral_fds = ephemeral_fds;
+ }
return expr;
}