Skip to content
Snippets Groups Projects
Commit 82ae6e0c authored by Mark Grondona's avatar Mark Grondona
Browse files

Send stderr to /dev/null instead of just closing it in io_close_all().

Otherwise log facility may still try to write to stderr which is either
a closed descriptor, or some other open file (like a socket)
parent dcf144b9
No related branches found
No related tags found
No related merge requests found
......@@ -893,6 +893,7 @@ io_close_task_fds(slurmd_job_t *job)
void
io_close_all(slurmd_job_t *job)
{
int devnull;
#if 0
int i;
for (i = 0; i < job->ntasks; i++)
......@@ -902,7 +903,17 @@ io_close_all(slurmd_job_t *job)
/* No more debug info will be received by client after this point
*/
debug("Closing debug channel");
close(STDERR_FILENO);
/*
* Send stderr to /dev/null since debug channel is closing
* and log facility may still try to write to stderr.
*/
if ((devnull = open("/dev/null", O_RDWR)) < 0) {
error("Unable to open /dev/null: %m");
} else {
if (dup2(devnull, STDERR_FILENO) < 0)
error("Unable to dup /dev/null onto stderr\n");
}
/* Signal IO thread to close appropriate
* client connections
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment