From f07575260c73ebc9010764ee9abf2a4e6e6f696e Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Fri, 3 Aug 2018 07:19:47 +0100 Subject: [PATCH] =?utf8?q?perform=5Ftask:=20fix=20issue=20#4:=20don?= =?utf8?q?=E2=80=99t=20close=20file=20descriptors=20given=20by=20caller?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/task.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/task.c b/src/task.c index 3ec4951..962a4fb 100644 --- a/src/task.c +++ b/src/task.c @@ -422,13 +422,13 @@ recode_perform_task (RECODE_TASK task) /* Final clean up. */ exit: - if (subtask->input.file && fclose (subtask->input.file) != 0) + if (subtask->input.file && subtask->input.file != task->input.file && fclose (subtask->input.file) != 0) { recode_perror (NULL, "fclose (%s)", subtask->input.name ? subtask->input.name : "stdin"); recode_if_nogo (RECODE_SYSTEM_ERROR, subtask); } - if (subtask->output.file && fclose (subtask->output.file) != 0) + if (subtask->output.file && subtask->output.file != task->output.file && fclose (subtask->output.file) != 0) { recode_perror (NULL, "fclose (%s)", subtask->output.name ? subtask->output.name : "stdout"); recode_if_nogo (RECODE_SYSTEM_ERROR, subtask); -- 2.40.0