Skip to content
Permalink
Browse files

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.
  • Loading branch information...
oliverkurth committed Jan 30, 2019
1 parent f4708f4 commit ba83c29fcd703ecb6a13a7767bad180033234aea
Showing with 4 additions and 4 deletions.
  1. +4 −4 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);

0 comments on commit ba83c29

Please sign in to comment.
You can’t perform that action at this time.