]> granicus.if.org Git - fcron/commitdiff
Close pipe in job.c even if there is an error reading it, to avoid a fd leak (thanks...
authorThibault Godouet <fcron@free.fr>
Sun, 29 Jun 2014 16:36:58 +0000 (17:36 +0100)
committerThibault Godouet <fcron@free.fr>
Sun, 29 Jun 2014 16:36:58 +0000 (17:36 +0100)
job.c

diff --git a/job.c b/job.c
index 24b1f828d8a3d412ae18e6a38d733f294e5e797e..abb0405e76fbc2bcbaeb3bf1b797cb695b43b0d8 100644 (file)
--- 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]");