]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
guestOS: Uniquely run time identify Photon
authorOliver Kurth <okurth@vmware.com>
Mon, 23 Oct 2017 21:21:20 +0000 (14:21 -0700)
committerOliver Kurth <okurth@vmware.com>
Mon, 23 Oct 2017 21:21:20 +0000 (14:21 -0700)
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 b209b93ff89130892fb669051b3f4423fabf9e32..46f156093f30b008f2ecb81448acc22c5ef1ba86 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);