]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
guestOS: Uniquely run time identify Photon
authorOliver Kurth <okurth@vmware.com>
Wed, 15 Nov 2017 21:32:53 +0000 (13:32 -0800)
committerOliver Kurth <okurth@vmware.com>
Wed, 15 Nov 2017 21:32:53 +0000 (13:32 -0800)
Currently VMware Photon 2 is identified at run time as a Linux 4.x kernel.
This is correct, but the Photon distro has an LSB compliant identification
file.

Attempt to check the LSB compliant identification file for Photon. If
present, identify the guest as "vmware-photon".

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

index 5d2123d03c43ef53748edacbf1995003434641f6..fa8f7b415c4761a49434ba7bc8f2311af2f37fe3 100644 (file)
@@ -485,17 +485,8 @@ HostinfoGetOSShortName(char *distro,         // IN: full distro name
                        int distroShortSize)  // IN: size of short distro name
 
 {
-   char *distroLower = NULL;  /* Lower case distro name */
+   char *distroLower = Util_SafeStrdup(distro);
 
-   distroLower = calloc(strlen(distro) + 1, sizeof *distroLower);
-
-   if (distroLower == NULL) {
-      Warning("%s: could not allocate memory\n", __FUNCTION__);
-
-      return;
-   }
-
-   Str_Strcpy(distroLower, distro, distroShortSize);
    distroLower = Str_ToLower(distroLower);
 
    if (strstr(distroLower, "red hat")) {
@@ -664,6 +655,8 @@ HostinfoGetOSShortName(char *distro,         // IN: full distro name
       Str_Strcpy(distroShort, STR_OS_VALINUX, distroShortSize);
    } else if (strstr(distroLower, "yellow dog")) {
       Str_Strcpy(distroShort, STR_OS_YELLOW_DOG, distroShortSize);
+   } else if (strstr(distroLower, "vmware photon")) {
+      Str_Strcpy(distroShort, STR_OS_PHOTON, distroShortSize);
    }
 
    free(distroLower);