Skip to content
Snippets Groups Projects
Commit 927dd305 authored by Moe Jette's avatar Moe Jette
Browse files

Add tests for zero pid/sid before sending signals.

This has not been observed, but just an extra test for safety.
parent eff1b9f8
No related branches found
No related tags found
No related merge requests found
......@@ -688,11 +688,12 @@ _rpc_kill_tasks(slurm_msg_t *msg, slurm_addr *cli_addr)
kill_proc_tree(step->sid, req->signal);
rc = SLURM_SUCCESS;
} else {
if (kill(-step->sid, req->signal) < 0)
if (step->sid
&& (kill(-step->sid, req->signal) < 0))
rc = errno;
if (step->task_list
&& (kill (-step->task_list->pid, req->signal) < 0))
if (step->task_list && step->task_list->pid
&& (kill (-step->task_list->pid, req->signal) < 0))
rc = errno;
if (rc == SLURM_SUCCESS)
......@@ -961,10 +962,11 @@ _kill_all_active_steps(uint32_t jobid, int sig, bool batch)
} else {
debug2("signal %d to job %u (pg:%d)",
sig, jobid, s->sid);
if (kill(-s->sid, sig) < 0)
if (s->sid
&& (kill(-s->sid, sig) < 0))
error("kill jid %d sid %d: %m",
s->jobid, s->sid);
if (s->task_list
if (s->task_list && s->task_list->pid
&& (kill(-s->task_list->pid, sig) < 0))
error("kill jid %d pgrp %d: %m",
s->jobid, s->task_list->pid);
......
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