From: Haritha D via GitGitGadget Date: Mon, 13 Nov 2023 10:24:09 GMT Subject: [PATCH 07/13] spaces and errors fix Handled git pipeline errors Message-ID: <8165196f869267ff35d2b252c20a622013b0fb04.1699871056.git.gitgitgadget@gmail.com> In-Reply-To: From: Haritha D This PR has fixes to enable build on z/OS Signed-off-by: Harithamma D --- convert.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/convert.c b/convert.c index 7fe107710ec..c8d30011458 100644 --- a/convert.c +++ b/convert.c @@ -1314,9 +1314,15 @@ static int git_path_check_ident(struct attr_check_item *check) static struct attr_check *check; static const char* get_platform(void) { - struct utsname uname_info = {0}; + struct utsname uname_info; char *result = NULL; - if(!uname_info.sysname[0]) + + if (uname(&uname_info) < 0) + die(_("uname() failed with error '%s' (%d)\n"), + strerror(errno), + errno); + + if(*uname_info.sysname != '\0') { int index=0; result = (char *)malloc(strlen(uname_info.sysname)+1); @@ -1326,15 +1332,13 @@ static const char* get_platform(void) { ++result; ++index; } + *result = '\0'; } - if (uname(&uname_info)) - die(_("uname() failed with error '%s' (%d)\n"), - strerror(errno), - errno); - +#ifdef __MVS__ if (!strcmp(uname_info.sysname, "OS/390")) result="zos"; +#endif return result; } -- gitgitgadget