From 053e6fab7ebc8fd049d3a2c5e14b2cafa7913e6e Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Mon, 20 Apr 2015 14:33:56 -0700
Subject: [PATCH] Initialize variables to avoid errors

This initializes some variables used with the srun --no-alloc option
that can result in test1.26 failing sporatically.
---
 src/api/step_ctx.c      | 1 +
 src/slurmd/slurmd/req.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/api/step_ctx.c b/src/api/step_ctx.c
index 914b8543297..c809049354b 100644
--- a/src/api/step_ctx.c
+++ b/src/api/step_ctx.c
@@ -89,6 +89,7 @@ _job_fake_cred(struct slurm_step_ctx_struct *ctx)
 	slurm_cred_arg_t arg;
 	uint32_t node_cnt = ctx->step_resp->step_layout->node_cnt;
 
+	memset(&arg, 0, sizeof(slurm_cred_arg_t));
 	arg.jobid          = ctx->job_id;
 	arg.stepid         = ctx->step_resp->job_step_id;
 	arg.uid            = ctx->user_id;
diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c
index cceb9942898..147f632a645 100644
--- a/src/slurmd/slurmd/req.c
+++ b/src/slurmd/slurmd/req.c
@@ -905,7 +905,6 @@ _check_job_credential(launch_tasks_request_msg_t *req, uid_t uid,
 			      " %m, but continuing anyway.");
 		}
 	}
-	req->job_core_spec = arg.job_core_spec;
 
 	/* If uid is the SlurmUser or root and the credential is bad,
 	 * then do not attempt validating the credential */
@@ -1082,6 +1081,7 @@ _check_job_credential(launch_tasks_request_msg_t *req, uid_t uid,
 		req->job_mem_lim *= job_cpus;
 	} else
 		req->job_mem_lim  = arg.job_mem_limit;
+	req->job_core_spec = arg.job_core_spec;
 	req->node_cpus = step_cpus;
 #if 0
 	info("%u.%u node_id:%d mem orig:%u cpus:%u limit:%u",
-- 
GitLab