From: Oliver Kurth Date: Fri, 26 Oct 2018 17:44:56 +0000 (-0700) Subject: Tools: More clean up from the guest mapping changes X-Git-Tag: stable-11.0.0~383 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7847e083e1a9db3dd6c38f07a67e52e58e061dd;p=thirdparty%2Fopen-vm-tools.git Tools: More clean up from the guest mapping changes A few more places to improve the code. --- diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c index 077dbfbe3..1a5ea7c6f 100644 --- a/open-vm-tools/lib/misc/hostinfoPosix.c +++ b/open-vm-tools/lib/misc/hostinfoPosix.c @@ -565,7 +565,7 @@ HostinfoOSDetailedData(void) const char *c; char escapedString[2 * MAX_DETAILED_FIELD_LEN + 1]; char fieldString[MAX_DETAILED_FIELD_LEN]; - uint32 i = 0; + int32 i = 0; /* Escape single quotes and back slashes in the value. */ for (c = field->value; *c != '\0'; c++) { @@ -578,6 +578,11 @@ HostinfoOSDetailedData(void) escapedString[i] = '\0'; + /* No trailing spaces */ + while (--i >= 0 && isspace(escapedString[i])) { + escapedString[i] = '\0'; + } + len = Str_Snprintf(fieldString, sizeof fieldString, "%s='%s'", field->name, escapedString); if (len == -1) {