From: Oliver Kurth Date: Wed, 30 Oct 2019 18:21:53 +0000 (-0700) Subject: Common source file change not directly applicable to open-vm-tools. X-Git-Tag: stable-11.0.5~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c09ff48397af1ea7c33d37018ed01a46338beb4;p=thirdparty%2Fopen-vm-tools.git Common source file change not directly applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c index 348a67ecb..e7ae9d257 100644 --- a/open-vm-tools/lib/misc/hostinfoPosix.c +++ b/open-vm-tools/lib/misc/hostinfoPosix.c @@ -733,23 +733,49 @@ static Bool HostinfoESX(struct utsname *buf) // IN: { int len; + uint32 major; + uint32 minor; char osName[MAX_OS_NAME_LEN]; char osNameFull[MAX_OS_FULLNAME_LEN]; - /* The most recent osName always goes here. */ - Str_Strcpy(osName, STR_OS_VMKERNEL "7", sizeof osName); + if (sscanf(buf->release, "%u.%u", &major, &minor) != 2) { + if (sscanf(buf->release, "%u", &major) != 1) { + major = 0; + } + + minor = 0; + } - /* Handle any special cases */ - if ((buf->release[0] <= '4') && (buf->release[1] == '.')) { + switch (major) { + case 0: + case 1: + case 2: + case 3: + case 4: Str_Strcpy(osName, STR_OS_VMKERNEL, sizeof osName); - } else if ((buf->release[0] == '5') && (buf->release[1] == '.')) { + break; + + case 5: Str_Strcpy(osName, STR_OS_VMKERNEL "5", sizeof osName); - } else if ((buf->release[0] >= '6') && (buf->release[1] == '.')) { - if (buf->release[2] < '5') { + break; + + case 6: + if (minor < 5) { Str_Strcpy(osName, STR_OS_VMKERNEL "6", sizeof osName); } else { Str_Strcpy(osName, STR_OS_VMKERNEL "65", sizeof osName); } + break; + + case 7: + default: + /* + * New osName are created IFF the VMX/monitor requires them (rare), + * not (simply) with every ESXi release. + */ + + Str_Strcpy(osName, STR_OS_VMKERNEL "7", sizeof osName); + break; } len = Str_Snprintf(osNameFull, sizeof osNameFull, "VMware ESXi %s",