]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix CentOS 7.6 detection
authorOliver Kurth <okurth@vmware.com>
Wed, 30 Jan 2019 01:24:44 +0000 (17:24 -0800)
committerOliver Kurth <okurth@vmware.com>
Wed, 30 Jan 2019 01:24:44 +0000 (17:24 -0800)
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.

open-vm-tools/lib/misc/hostinfoPosix.c

index b6ebaa7e78e592648230c150ba4703989421a648..48dfb28b2086704c4eb51dcefdb639c8bd67adf4 100644 (file)
@@ -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);