From 0be489aa2f86d3eab3aa75f5bdaf90835014bcee Mon Sep 17 00:00:00 2001 From: motodiary Date: Thu, 6 Jun 2024 10:09:45 +0800 Subject: [PATCH] replace goto fini --- 0044-replace-goto-fini.patch | 104 +++++++++++++++++++++++++++++++++++ slurm.spec | 6 +- 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 0044-replace-goto-fini.patch diff --git a/0044-replace-goto-fini.patch b/0044-replace-goto-fini.patch new file mode 100644 index 0000000..2103630 --- /dev/null +++ b/0044-replace-goto-fini.patch @@ -0,0 +1,104 @@ +From ca4cd2880089e4826251fe240bb5c74e15aa78ae Mon Sep 17 00:00:00 2001 +From: motodiary +Date: Thu, 6 Jun 2024 10:07:11 +0800 +Subject: [PATCH] replace goto fini + +--- + src/database/pgsql_common.c | 26 ++++++++++++++++---------- + 1 file changed, 16 insertions(+), 10 deletions(-) + +diff --git a/src/database/pgsql_common.c b/src/database/pgsql_common.c +index ee2a476..241307e 100755 +--- a/src/database/pgsql_common.c ++++ b/src/database/pgsql_common.c +@@ -1190,7 +1190,8 @@ extern pgsql_res_t* pgsql_db_query_ret(pgsql_conn_t *pgsql_conn, + + _init_pgsql_res(&result, pgsql_conn); + if(result == NULL){ +- goto fini; ++ slurm_mutex_unlock(&pgsql_conn->lock); ++ return result; + } + + if (SLURM_SUCCESS == _pgsql_query_internal(pgsql_conn->db_conn, query, result->stmt, (SQLCHAR*)(result->state))) { +@@ -1203,14 +1204,16 @@ extern pgsql_res_t* pgsql_db_query_ret(pgsql_conn_t *pgsql_conn, + SQLCHAR state[PGSQL_STATE_LEN + 1]; + PGSQL_HANDLE_ERROR("SQLRowCount", rc, SQL_HANDLE_STMT, result->stmt, state); + pgsql_free_result(&result); +- goto fini; ++ slurm_mutex_unlock(&pgsql_conn->lock); ++ return result; + } + + if (result->sNumRows > 0) { + result->rows = (pgsql_row*)malloc(result->sNumRows * sizeof(pgsql_row)); + if(result->rows == NULL) { + pgsql_free_result(&result); +- goto fini; ++ slurm_mutex_unlock(&pgsql_conn->lock); ++ return result; + } + for(int i = 0; i < result->sNumRows; i++) { + result->rows[i] = NULL; +@@ -1218,7 +1221,6 @@ extern pgsql_res_t* pgsql_db_query_ret(pgsql_conn_t *pgsql_conn, + } + } + +-fini: + slurm_mutex_unlock(&pgsql_conn->lock); + + return result; +@@ -1245,14 +1247,16 @@ fini: + SQLCHAR state[PGSQL_STATE_LEN + 1]; + PGSQL_HANDLE_ERROR("SQLMoreResults", rc, SQL_HANDLE_STMT, result->stmt, state); + pgsql_free_result(&result); +- goto fini; ++ slurm_mutex_unlock(&pgsql_conn->lock); ++ return result; + } else { + + // init a new result + pgsql_free_result(&result); + _init_pgsql_res(&result, pgsql_conn); + if(result == NULL){ +- goto fini; ++ slurm_mutex_unlock(&pgsql_conn->lock); ++ return result; + } + + SQLNumResultCols(result->stmt, &result->sNumCols); +@@ -1261,14 +1265,16 @@ fini: + SQLCHAR state[PGSQL_STATE_LEN + 1]; + PGSQL_HANDLE_ERROR("SQLRowCount", rc, SQL_HANDLE_STMT, result->stmt, state); + pgsql_free_result(&result); +- goto fini; ++ slurm_mutex_unlock(&pgsql_conn->lock); ++ return result; + } + + if (result->sNumRows > 0) { + result->rows = (pgsql_row*)malloc(result->sNumRows * sizeof(pgsql_row)); + if(result->rows == NULL) { + pgsql_free_result(&result); +- goto fini; ++ slurm_mutex_unlock(&pgsql_conn->lock); ++ return result; + } + for(int i = 0; i < result->sNumRows; i++) { + result->rows[i] = NULL; +@@ -1288,10 +1294,10 @@ fini: + + } else { + pgsql_free_result(&result); +- goto fini; ++ slurm_mutex_unlock(&pgsql_conn->lock); ++ return result; + } + +-fini: + slurm_mutex_unlock(&pgsql_conn->lock); + + return result; +-- +2.33.0 + diff --git a/slurm.spec b/slurm.spec index 0bbe097..3e598c2 100644 --- a/slurm.spec +++ b/slurm.spec @@ -1,6 +1,6 @@ Name: slurm Version: 21.08.8 -%define rel 46 +%define rel 47 Release: %{rel}%{?dist} Summary: Slurm Workload Manager @@ -59,6 +59,7 @@ Patch40: 0040-Remove-redundant-SQL-statements-in-adding-tres.patch Patch41: 0041-Fix-compilation-warnings.patch Patch42: 0042-Change-the-serial-type-to-integer.patch Patch43: 0043-Remove-redundant-tres_table-fields.patch +Patch44: 0044-replace-goto-fini.patch # build options .rpmmacros options change to default action # ==================== ==================== ======================== @@ -751,6 +752,9 @@ rm -rf %{buildroot} %systemd_postun_with_restart slurmdbd.service %changelog +* Thu Jun 06 2024 Xing Liu - 21.08.8-47 +- replace goto fini + * Wed Jun 05 2024 Xing Liu - 21.08.8-46 - Remove redundant tres_table fields -- Gitee