From: Oliver Kurth Date: Mon, 23 Oct 2017 21:21:20 +0000 (-0700) Subject: guestOS: Uniquely run time identify Photon X-Git-Tag: stable-10.3.0~255 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fae8543aaeed65725575dac50c55ea554b349a1;p=thirdparty%2Fopen-vm-tools.git guestOS: Uniquely run time identify Photon 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". --- diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c index b209b93ff..46f156093 100644 --- a/open-vm-tools/lib/misc/hostinfoPosix.c +++ b/open-vm-tools/lib/misc/hostinfoPosix.c @@ -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);