This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-daemon.git
The following commit(s) were added to refs/heads/master by this push: new cee15ad Fix truncated log messages cee15ad is described below commit cee15add7ddbe95fde4ac8d956a0d2ce53209dbe Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Dec 10 11:51:32 2024 +0000 Fix truncated log messages --- src/changes/changes.xml | 4 ++++ src/native/windows/src/registry.c | 6 +++--- src/native/windows/src/service.c | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index c145e5f..fb3454f 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -45,6 +45,10 @@ <action dev="michaelo" type="fix"> Fix several issues around Java OS and header files location detection. </action> + <action dev="markt" type="fix"> + Correct several log messages where an incorrect placeholder led to + truncation of the inserted values. + </action> <!-- Add --> <action issue="DAEMON-460" dev="markt" type="add"> Add protection to avoid high CPU usage for applications running in JVM diff --git a/src/native/windows/src/registry.c b/src/native/windows/src/registry.c index 89ff554..d0955e0 100644 --- a/src/native/windows/src/registry.c +++ b/src/native/windows/src/registry.c @@ -858,7 +858,7 @@ BOOL apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription, DWORD t = REG_SZ; int iServiceNameLen = lstrlenW(szServiceName); if (iServiceNameLen > SIZ_RESMAX) { - apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%s' length %d > %d", szServiceName, iServiceNameLen, SIZ_RESMAX); + apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%S' length %d > %d", szServiceName, iServiceNameLen, SIZ_RESMAX); return FALSE; } lstrcpyW(wcName, REGSERVICE_ROOT); @@ -866,7 +866,7 @@ BOOL apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription, rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, wcName, 0, KEY_READ, &hKey); if (rc != ERROR_SUCCESS) { - apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%s' cannot be opened (rc = %d)", wcName, rc); + apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%S' cannot be opened (rc = %d)", wcName, rc); return FALSE; } rc = RegQueryValueExW(hKey, REGDESCRIPTION, NULL, &t, (BYTE *)szDescription, @@ -875,7 +875,7 @@ BOOL apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription, if (rc == ERROR_SUCCESS && t == REG_SZ) return TRUE; else { - apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%s' cannot query value at '%s' (rc = %d)", wcName, REGDESCRIPTION, rc); + apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%S' cannot query value at '%S' (rc = %d)", wcName, REGDESCRIPTION, rc); return FALSE; } } diff --git a/src/native/windows/src/service.c b/src/native/windows/src/service.c index 582d111..8214634 100644 --- a/src/native/windows/src/service.c +++ b/src/native/windows/src/service.c @@ -156,13 +156,13 @@ apxServiceOpen(APXHANDLE hService, LPCWSTR szServiceName, DWORD dwOptions) if (!apxGetServiceDescriptionW(szServiceName, lpService->stServiceEntry.szServiceDescription, SIZ_DESLEN)) { - apxLogWrite(APXLOG_MARK_WARN "Failed to obtain service description for '%s'", szServiceName); + apxLogWrite(APXLOG_MARK_WARN "Failed to obtain service description for '%S'", szServiceName); lpService->stServiceEntry.szServiceDescription[0] = L'\0'; } if (!apxGetServiceUserW(szServiceName, lpService->stServiceEntry.szObjectName, SIZ_RESLEN)) { - apxLogWrite(APXLOG_MARK_WARN "Failed to obtain service user name for '%s'", szServiceName); + apxLogWrite(APXLOG_MARK_WARN "Failed to obtain service user name for '%S'", szServiceName); lpService->stServiceEntry.szObjectName[0] = L'\0'; } if (!QueryServiceConfigW(lpService->hService, NULL, 0, &dwNeeded)) {