summaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/exec.c b/exec.c
index d1503fe..2b18ce8 100644
--- a/exec.c
+++ b/exec.c
@@ -446,13 +446,14 @@ static bool bfs_exec_args_remain(const struct bfs_exec *execbuf) {
/** Execute the pending command from a BFS_EXEC_MULTI execbuf. */
static int bfs_exec_flush(struct bfs_exec *execbuf) {
- int ret = 0;
+ int ret = 0, error = 0;
size_t orig_argc = execbuf->argc;
while (bfs_exec_args_remain(execbuf)) {
execbuf->argv[execbuf->argc] = NULL;
ret = bfs_exec_spawn(execbuf);
- if (ret == 0 || errno != E2BIG) {
+ error = errno;
+ if (ret == 0 || error != E2BIG) {
break;
}
@@ -466,8 +467,6 @@ static int bfs_exec_flush(struct bfs_exec *execbuf) {
size_t new_argc = execbuf->argc;
size_t new_size = execbuf->arg_size;
- int error = errno;
-
for (size_t i = execbuf->tmpl_argc - 1; i < new_argc; ++i) {
free(execbuf->argv[i]);
}