From 622bcf9d46a763b7aaba75fa8421533bcbe4b981 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 12 Nov 2017 13:11:58 -0500 Subject: exec: Recover from E2BIG --- parse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'parse.c') 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; } -- cgit v1.2.3