Module: check_mk
Branch: master
Commit: 2f9d4e33e404bc2131ff17f713e861749f9a5bba
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2f9d4e33e404bc…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Fri Nov 20 10:52:46 2015 +0100
windows agent: fixed two bugs introduced recently
first bug: related to incorrect casting of service nam strings
second bug: incorrect printf format specifier
thanks to Flavio Stanchina for reporting these bugs
---
agents/windows/Configuration.cc | 2 +-
agents/windows/Environment.cc | 5 +++--
agents/windows/ListenSocket.cc | 2 +-
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 5361545 -> 5397569 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 5361545 -> 5397569 bytes
agents/windows/check_mk_agent.cc | 6 +++---
agents/windows/check_mk_agent.exe | Bin 4223010 -> 4257835 bytes
agents/windows/check_mk_agent.msi | Bin 9908224 -> 9979904 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 4223010 -> 4257835 bytes
agents/windows/install_agent-64.exe | Bin 1278681 -> 1288915 bytes
agents/windows/install_agent.exe | Bin 1161640 -> 1169701 bytes
12 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/agents/windows/Configuration.cc b/agents/windows/Configuration.cc
index 02f4aed..6169d64 100644
--- a/agents/windows/Configuration.cc
+++ b/agents/windows/Configuration.cc
@@ -30,7 +30,7 @@
#include <cassert>
-extern void verbose(const char *format, ...);
+extern void verbose(const char *format, ...) __attribute__ ((format (gnu_printf, 1,
2)));
static const int CHECK_MK_AGENT_PORT = 6556;
diff --git a/agents/windows/Environment.cc b/agents/windows/Environment.cc
index 0c59011..a4d4ed8 100644
--- a/agents/windows/Environment.cc
+++ b/agents/windows/Environment.cc
@@ -33,7 +33,7 @@
using namespace std;
-extern void crash_log(const char *format, ...);
+extern void crash_log(const char *format, ...) __attribute__ ((format (gnu_printf, 1,
2)));
// technically this is the limit for path names on windows, practically few applications
and not
@@ -99,7 +99,8 @@ string Environment::assignDirectory(const char *name)
string result(_agent_directory + "\\" + name);
if (!CreateDirectoryA(result.c_str(), NULL)) {
if (GetLastError() != ERROR_ALREADY_EXISTS) {
- crash_log("Failed to create directory %s: %s", GetLastError(),
get_win_error_as_string().c_str());
+ crash_log("Failed to create directory %s: %s (%lu)",
+ name, get_win_error_as_string().c_str(), GetLastError());
}
}
return result;
diff --git a/agents/windows/ListenSocket.cc b/agents/windows/ListenSocket.cc
index 7134952..12b0deb 100644
--- a/agents/windows/ListenSocket.cc
+++ b/agents/windows/ListenSocket.cc
@@ -31,7 +31,7 @@
#ifdef DEBUG
-extern void debug(char *text);
+extern void debug(char *text) __attribute__ ((format (gnu_printf, 1, 2)));
#else
#define debug(C)
#endif
diff --git a/agents/windows/build_version b/agents/windows/build_version
index 775971e..eddc111 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-648
+652
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 840dbf5..f2f44d9 100755
Binary files a/agents/windows/check_mk_agent-64.exe and
b/agents/windows/check_mk_agent-64.exe differ
diff --git a/agents/windows/check_mk_agent-64.unversioned.exe
b/agents/windows/check_mk_agent-64.unversioned.exe
index c76c4f2..f81b14f 100755
Binary files a/agents/windows/check_mk_agent-64.unversioned.exe and
b/agents/windows/check_mk_agent-64.unversioned.exe differ
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index 668eb7a..4a1926f 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -563,9 +563,9 @@ void section_services(SOCKET &out)
// in some cases it does. We replace them with _ in order
// the keep it in one space-separated column. Since we own
// the buffer, we can simply change the name inplace.
- for (char *w=(char *)(service->lpServiceName); *w; w++) {
- if (*w == ' ')
- *w = '_';
+ for (LPWSTR w=service->lpServiceName; *w; ++w) {
+ if (*w == L' ')
+ *w = L'_';
}
output(out, "%ls %s/%s %s\n",
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 883c27d..ca63b45 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/check_mk_agent.msi b/agents/windows/check_mk_agent.msi
index 0660837..ea68c9b 100755
Binary files a/agents/windows/check_mk_agent.msi and b/agents/windows/check_mk_agent.msi
differ
diff --git a/agents/windows/check_mk_agent.unversioned.exe
b/agents/windows/check_mk_agent.unversioned.exe
index 9ab3fe6..c49bdc2 100755
Binary files a/agents/windows/check_mk_agent.unversioned.exe and
b/agents/windows/check_mk_agent.unversioned.exe differ
diff --git a/agents/windows/install_agent-64.exe b/agents/windows/install_agent-64.exe
index e3a792f..2798d57 100755
Binary files a/agents/windows/install_agent-64.exe and
b/agents/windows/install_agent-64.exe differ
diff --git a/agents/windows/install_agent.exe b/agents/windows/install_agent.exe
index 51c127b..7cf166c 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ