From 8b9aab3796b42a19d965306ac6af7da255fca611 Mon Sep 17 00:00:00 2001 From: Thibault Godouet Date: Sun, 29 Jun 2014 17:36:58 +0100 Subject: [PATCH] Close pipe in job.c even if there is an error reading it, to avoid a fd leak (thanks Pavel Stano) --- job.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/job.c b/job.c index 24b1f82..abb0405 100644 --- a/job.c +++ b/job.c @@ -738,16 +738,16 @@ run_job(struct exe_t *exeent) /* read the pid of the job */ ret = read_pipe(pipe_pid_fd[0], &(exeent->e_job_pid), sizeof(pid_t)); if (ret != OK) { - if (ret == ERR) + if (ret == ERR) { error("Could not read job pid because of closed pipe:" " setting it to -1"); + } else { errno = ret; error_e("Could not read job pid : setting it to -1"); } exeent->e_job_pid = -1; - break; } xclose_check(&(pipe_pid_fd[0]), "parent's pipe_pid_fd[0]"); -- 2.47.3