]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Tools: More clean up from the guest mapping changes
authorOliver Kurth <okurth@vmware.com>
Fri, 26 Oct 2018 17:44:56 +0000 (10:44 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 26 Oct 2018 17:44:56 +0000 (10:44 -0700)
A few more places to improve the code.

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

index 077dbfbe384e964bf4dfca2e73354a0c7130461c..1a5ea7c6ffbe32f2d1e9896c47306a6f85c55321 100644 (file)
@@ -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) {