File U_25-Reclaim-a-tab-stop.patch of Package slurm.32313

From: Tim Wickberg <tim@schedmd.com>
Date: Wed Nov 29 15:51:13 2023 -0700
Subject: [PATCH 25/28]Reclaim a tab stop.
Patch-mainline: Upstream
Git-repo: https://github.com/SchedMD/slurm
Git-commit: 209b7b7167f305bb20450ab4a73dc6b566891b85
References: bsc#1218046, bsc#1218050, bsc#1218051, bsc#1218053
Signed-off-by: Egbert Eich <eich@suse.de>

---
 src/common/pack.c | 51 +++++++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 24 deletions(-)

diff --git a/src/common/pack.c b/src/common/pack.c
index bede56e854..fb11446f60 100644
--- a/src/common/pack.c
+++ b/src/common/pack.c
@@ -977,6 +977,8 @@ unpack_error:
  */
 int unpackstr_xmalloc_escaped(char **valp, uint32_t *size_valp, Buf buffer)
 {
+	uint32_t cnt;
+
 	*valp = NULL;
 	safe_unpack32(size_valp, buffer);
 
@@ -987,37 +989,38 @@ int unpackstr_xmalloc_escaped(char **valp, uint32_t *size_valp, Buf buffer)
 		error("%s: Buffer to be unpacked is too large (%u > %u)",
 		      __func__, *size_valp, MAX_PACK_MEM_LEN);
 		return SLURM_ERROR;
-	} else if (*size_valp > 0) {
-		uint32_t cnt = *size_valp;
+	}
 
-		if (remaining_buf(buffer) < cnt)
-			return SLURM_ERROR;
+	cnt = *size_valp;
 
-		/* make a buffer 2 times the size just to be safe */
-		*valp = xmalloc_nz((cnt * 2) + 1);
-		if (*valp) {
-			char *copy = NULL, *str, tmp;
-			uint32_t i;
-			copy = *valp;
-			str = &buffer->head[buffer->processed];
-
-			for (i = 0; i < cnt && *str; i++) {
-				tmp = *str++;
-				if ((tmp == '\\') || (tmp == '\'')) {
-					*copy++ = '\\';
-					(*size_valp)++;
-				}
-
-				*copy++ = tmp;
+	if (remaining_buf(buffer) < cnt)
+		return SLURM_ERROR;
+
+	/* make a buffer 2 times the size just to be safe */
+	*valp = xmalloc_nz((cnt * 2) + 1);
+	if (*valp) {
+		char *copy = NULL, *str, tmp;
+		uint32_t i;
+		copy = *valp;
+		str = &buffer->head[buffer->processed];
+
+		for (i = 0; i < cnt && *str; i++) {
+			tmp = *str++;
+			if ((tmp == '\\') || (tmp == '\'')) {
+				*copy++ = '\\';
+				(*size_valp)++;
 			}
 
-			/* Since we used xmalloc_nz, terminate the string. */
-			*copy++ = '\0';
+			*copy++ = tmp;
 		}
 
-		/* add the original value since that is what we processed */
-		buffer->processed += cnt;
+		/* Since we used xmalloc_nz, terminate the string. */
+		*copy++ = '\0';
 	}
+
+	/* add the original value since that is what we processed */
+	buffer->processed += cnt;
+
 	return SLURM_SUCCESS;
 
 unpack_error:
openSUSE Build Service is sponsored by