From: Oliver Kurth Date: Wed, 30 Jan 2019 01:24:44 +0000 (-0800) Subject: Fix CentOS 7.6 detection X-Git-Tag: stable-10.3.10~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba83c29fcd703ecb6a13a7767bad180033234aea;p=thirdparty%2Fopen-vm-tools.git Fix CentOS 7.6 detection The version information in /etc/centos-release has 3 parts, in particular for CentOS 7.6: CentOS Linux release 7.6.1810 (Core) This was misidentified as CentOS 6 because the substring "6." was matched before matching "7.". This change fixes this by requiring a space before the major version. --- diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c index b6ebaa7e7..48dfb28b2 100644 --- a/open-vm-tools/lib/misc/hostinfoPosix.c +++ b/open-vm-tools/lib/misc/hostinfoPosix.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2018 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -790,11 +790,11 @@ HostinfoGetOSShortName(char *distro, // IN: full distro name } else if (strstr(distroLower, "cobalt")) { Str_Strcpy(distroShort, STR_OS_COBALT, distroShortSize); } else if (StrUtil_StartsWith(distroLower, "centos")) { - if (strstr(distroLower, "6.")) { + if (strstr(distroLower, " 6.")) { Str_Strcpy(distroShort, STR_OS_CENTOS6, distroShortSize); - } else if (strstr(distroLower, "7.")) { + } else if (strstr(distroLower, " 7.")) { Str_Strcpy(distroShort, STR_OS_CENTOS7, distroShortSize); - } else if (strstr(distroLower, "8.")) { + } else if (strstr(distroLower, " 8.")) { Str_Strcpy(distroShort, STR_OS_CENTOS8, distroShortSize); } else { Str_Strcpy(distroShort, STR_OS_CENTOS, distroShortSize);