From: Oliver Kurth Date: Wed, 11 Dec 2019 18:19:08 +0000 (-0800) Subject: Tools-11.0.5 - Trim trailing whitespace from log params in /etc/tools.conf. X-Git-Tag: stable-11.0.5~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcaa29ff7269cb73002db455f7d7e6bd8de29d3c;p=thirdparty%2Fopen-vm-tools.git Tools-11.0.5 - Trim trailing whitespace from log params in /etc/tools.conf. Remove trailing whitespace from pathnames and parameters in tools.conf. --- diff --git a/open-vm-tools/libvmtools/vmtoolsLog.c b/open-vm-tools/libvmtools/vmtoolsLog.c index dd213e983..24b8066d7 100644 --- a/open-vm-tools/libvmtools/vmtoolsLog.c +++ b/open-vm-tools/libvmtools/vmtoolsLog.c @@ -864,6 +864,8 @@ VMToolsGetLogFilePath(const gchar *key, return VMToolsDefaultLogFilePath(domain); } + g_strchomp(path); + len = strlen(path); origPath = path; @@ -988,6 +990,9 @@ VMToolsGetLogHandler(const gchar *handler, /* Always get the facility from the default domain, since syslog is shared. */ g_snprintf(key, sizeof key, "%s.facility", gLogDomain); facility = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL); + if (facility != NULL) { + g_strchomp(facility); + } glogger = GlibUtils_CreateSysLogger(domain, facility); /* * Older versions of Linux make synchronous call to syslog. @@ -1090,14 +1095,22 @@ VMToolsConfigLogDomain(const gchar *domain, level = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL); if (level == NULL) { level = g_strdup(VMTOOLS_LOGGING_LEVEL_DEFAULT); + } else { + g_strchomp(level); } /* Parse the handler information. */ g_snprintf(key, sizeof key, "%s.handler", domain); handler = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL); + if (handler != NULL) { + g_strchomp(handler); + } g_snprintf(key, sizeof key, "%s.data", domain); confData = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL); + if (confData != NULL) { + g_strchomp(confData); + } /* * Disable the old vmx handler if we are setting up the vmx guest logger @@ -1817,6 +1830,8 @@ LoadFallbackSetting(GKeyFile *cfg) return; } + g_strchomp(handler); + if (strcmp(handler, "vmx") != 0) { g_debug("%s.handler is not a vmx handler in config file.\n", gLogDomain); g_free(handler); @@ -1830,6 +1845,8 @@ LoadFallbackSetting(GKeyFile *cfg) level = g_key_file_get_string(cfg, LOGGING_GROUP, key, NULL); if (NULL == level) { level = g_strdup(VMTOOLS_LOGGING_LEVEL_DEFAULT); + } else { + g_strchomp(level); } /* If guest admin allows debug log messages sent to host, honor it. */