diff mbox series

[10/13] strncpy fix Handled git pipeline errors

Message ID 63479fe36966bf3b1a8dbc3ae68f8558da4690bc.1699871056.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Enabling z/OS workflow for git | expand

Commit Message

Haritha D Nov. 13, 2023, 10:24 a.m. UTC
From: Haritha D <harithamma.d@ibm.com>

This PR has fixes to enable build on z/OS

Signed-off-by: Harithamma D <harithamma.d@ibm.com>
---
 convert.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/convert.c b/convert.c
index 78403de422d..ef44e6429da 100644
--- a/convert.c
+++ b/convert.c
@@ -1326,13 +1326,10 @@  static const char* get_platform(void) {
 	{
 		int index=0;
 		result = (char *)malloc(strlen(uname_info.sysname)+1);
-		while(index <= strlen(uname_info.sysname))
+		while(result[index] = uname_info.sysname[index])
 		{
-			*result = uname_info.sysname[index];
-			++result;
-			++index;
+			index++;
 		}
-		*result = '\0';
 	}
 #endif
 
@@ -1340,8 +1337,7 @@  static const char* get_platform(void) {
 	if (!strcmp(uname_info.sysname, "OS/390"))
 		result="zos";
 #endif
-
-	return result;
+	return (char*)result;
 }