From 05b0cda68a22a15cd11811a126904dca3834e5e9 Mon Sep 17 00:00:00 2001
From: Dominik Bartkiewicz <bart@schedmd.com>
Date: Thu, 21 Jan 2021 10:53:13 +0100
Subject: [PATCH] Change _handle_job() return on error to -1

list_for_each() breaks only if rc < 0

Bug 10570
---
 src/slurmctld/crontab.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/slurmctld/crontab.c b/src/slurmctld/crontab.c
index 44a252a426d..082738b685c 100644
--- a/src/slurmctld/crontab.c
+++ b/src/slurmctld/crontab.c
@@ -72,7 +72,7 @@ static int _handle_job(void *x, void *y)
 	if (!job->crontab_entry || !valid_cron_entry(job->crontab_entry)) {
 		error("crontab submission failed due to missing or invalid cron_entry_t");
 		args->return_code = SLURM_ERROR;
-		return 1;
+		return -1;
 	}
 
 	/*
@@ -102,7 +102,7 @@ static int _handle_job(void *x, void *y)
 		xstrfmtcat(*args->failed_lines, "%u-%u",
 			   ((cron_entry_t *) job->crontab_entry)->line_start,
 			   ((cron_entry_t *) job->crontab_entry)->line_end);
-		return 1;
+		return -1;
 	}
 
 	args->return_code = job_allocate(job, 0, false, NULL, 0, args->uid,
@@ -122,7 +122,7 @@ static int _handle_job(void *x, void *y)
 		xstrfmtcat(*args->failed_lines, "%u-%u",
 			   ((cron_entry_t *) job->crontab_entry)->line_start,
 			   ((cron_entry_t *) job->crontab_entry)->line_end);
-		return 1;
+		return -1;
 	} else {
 		xassert(job_ptr->details);
 		job_ptr->details->crontab_entry = job->crontab_entry;
-- 
GitLab