From 9c1d893fc1dee67ecba840d184a9671341ead66b Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Mon, 9 Jan 2017 16:37:54 -0700
Subject: [PATCH] Revert commit e45b9768fd

Accidentally commited to Slurm version 16.05 instead of master
---
 .../accounting_storage/mysql/as_mysql_archive.c   | 10 ++++------
 .../accounting_storage/mysql/as_mysql_assoc.c     |  7 +++----
 .../accounting_storage/mysql/as_mysql_job.c       | 15 +++++++++------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/plugins/accounting_storage/mysql/as_mysql_archive.c b/src/plugins/accounting_storage/mysql/as_mysql_archive.c
index f8307898de7..9cb29cc4900 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_archive.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_archive.c
@@ -2631,8 +2631,8 @@ extern int as_mysql_jobacct_process_archive_load(
 			     arch_rec->archive_file);
 			error_code = ENOENT;
 		} else {
-			data_allocated = BUF_SIZE + 1;
-			data = xmalloc_nz(data_allocated);
+			data_allocated = BUF_SIZE;
+			data = xmalloc(data_allocated);
 			while (1) {
 				data_read = read(state_fd, &data[data_size],
 						 BUF_SIZE);
@@ -2644,13 +2644,11 @@ extern int as_mysql_jobacct_process_archive_load(
 						      arch_rec->archive_file);
 						break;
 					}
-				}
-				data[data_read] = '\0';
-				if (data_read == 0)	/* eof */
+				} else if (data_read == 0)	/* eof */
 					break;
 				data_size      += data_read;
 				data_allocated += data_read;
-				xrealloc_nz(data, data_allocated);
+				xrealloc(data, data_allocated);
 			}
 			close(state_fd);
 		}
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_assoc.c b/src/plugins/accounting_storage/mysql/as_mysql_assoc.c
index 3086805c0a8..168a888eda4 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_assoc.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_assoc.c
@@ -1588,18 +1588,18 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 			}
 			xfree(tmp_qos);
 
-			set_qos_vals = 1;
+			set_qos_vals=1;
 		}
 
 
-		if (account_type) {
+		if (account_type)
 			_modify_unset_users(mysql_conn,
 					    mod_assoc,
 					    row[MASSOC_ACCT],
 					    lft, rgt,
 					    ret_list,
 					    moved_parent);
-		} else if ((assoc->is_def == 1) && row[MASSOC_USER][0]) {
+		else if ((assoc->is_def == 1) && row[MASSOC_USER][0]) {
 			/* Use fresh one here so we don't have to
 			   worry about dealing with bad values.
 			*/
@@ -1613,7 +1613,6 @@ static int _process_modify_assoc_results(mysql_conn_t *mysql_conn,
 				     mysql_conn, &tmp_assoc, &reset_query,
 				     moved_parent ? 0 : 1))
 			    != SLURM_SUCCESS) {
-				slurmdb_destroy_assoc_rec(mod_assoc);
 				xfree(reset_query);
 				goto end_it;
 			}
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_job.c b/src/plugins/accounting_storage/mysql/as_mysql_job.c
index 063bfcb48c0..e5876f0deef 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_job.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_job.c
@@ -240,12 +240,11 @@ no_wckeyid:
 extern int as_mysql_job_start(mysql_conn_t *mysql_conn,
 			      struct job_record *job_ptr)
 {
-	int rc = SLURM_SUCCESS;
+	int rc=SLURM_SUCCESS;
 	char *nodes = NULL, *jname = NULL, *node_inx = NULL;
 	int track_steps = 0;
-	char *block_id = NULL, *partition = NULL;
-	char *gres_req = NULL, *gres_alloc = NULL;
-	char temp_bit[BUF_SIZE];
+	char *block_id = NULL, *partition = NULL,
+		*gres_req = NULL, *gres_alloc = NULL;
 	char *query = NULL;
 	int reinit = 0;
 	time_t begin_time, check_time, start_time, submit_time;
@@ -422,6 +421,8 @@ no_rollup_change:
 		node_cnt = job_ptr->total_nodes;
 		node_inx = job_ptr->network;
 	} else {
+		char temp_bit[BUF_SIZE];
+
 		if (job_ptr->node_bitmap) {
 			node_inx = bit_fmt(temp_bit, sizeof(temp_bit),
 					   job_ptr->node_bitmap);
@@ -934,8 +935,7 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn,
 			       struct step_record *step_ptr)
 {
 	int tasks = 0, nodes = 0, task_dist = 0;
-	int rc = SLURM_SUCCESS;
-	char temp_bit[BUF_SIZE];
+	int rc=SLURM_SUCCESS;
 	char node_list[BUFFER_SIZE];
 	char *node_inx = NULL, *step_name = NULL;
 	time_t start_time, submit_time;
@@ -972,6 +972,8 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn,
 		task_dist = step_ptr->step_layout->task_dist;
 		node_inx = step_ptr->network;
 	} else if (step_ptr->step_id == SLURM_BATCH_SCRIPT) {
+		char temp_bit[BUF_SIZE];
+
 		if (step_ptr->step_node_bitmap) {
 			node_inx = bit_fmt(temp_bit, sizeof(temp_bit),
 					   step_ptr->step_node_bitmap);
@@ -989,6 +991,7 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn,
 				   TRES_NODE, 1);
 	} else {
 		char *ionodes = NULL, *temp_nodes = NULL;
+		char temp_bit[BUF_SIZE];
 
 		if (step_ptr->step_node_bitmap) {
 			node_inx = bit_fmt(temp_bit, sizeof(temp_bit),
-- 
GitLab