From dadfbe5e87d89abfeec13f28f6f5d842c300c734 Mon Sep 17 00:00:00 2001 From: Tim Wickberg <tim@schedmd.com> Date: Mon, 16 Oct 2017 13:56:32 -0600 Subject: [PATCH] Add checks on read() and write() returns for x11_pipe. --- src/slurmd/slurmstepd/mgr.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/slurmd/slurmstepd/mgr.c b/src/slurmd/slurmstepd/mgr.c index 5269071e601..64ec3179d38 100644 --- a/src/slurmd/slurmstepd/mgr.c +++ b/src/slurmd/slurmstepd/mgr.c @@ -1043,7 +1043,11 @@ static int _spawn_job_container(stepd_step_rec_t *job) } /* send back x11 display number to parent stepd */ - write(x11_pipe[1], &display, sizeof(int)); + if (write(x11_pipe[1], &display, sizeof(int)) + != sizeof(int)) { + error("%s: failed sending display number back: %m", + __func__); + } close(x11_pipe[1]); /* @@ -1104,7 +1108,12 @@ static int _spawn_job_container(stepd_step_rec_t *job) */ if (job->x11) { close(x11_pipe[1]); - read(x11_pipe[0], &job->x11_display, sizeof(int)); + if (read(x11_pipe[0], &job->x11_display, sizeof(int)) + != sizeof(int)) { + error("%s: failed retrieving x11 display value: %m", + __func__); + job->x11_display = 0; + } close(x11_pipe[0]); debug("x11 forwarding local display is %d", job->x11_display); -- GitLab