Module: check_mk
Branch: master
Commit: af47a37e216462c89efa8c188d67c68db297e410
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=af47a37e216462…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Fri Apr 13 15:51:27 2018 +0200
Win-agent: check correct retval of GetProcessTimes
GetProcessTimes returns nonzero upon success and zero upon failure.
---
agents/windows/build_version | 2 +-
agents/windows/sections/SectionPS.cc | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/agents/windows/build_version b/agents/windows/build_version
index c092de8..362875e 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-3246
+3248
diff --git a/agents/windows/sections/SectionPS.cc b/agents/windows/sections/SectionPS.cc
index 310fd39..13a1e97 100644
--- a/agents/windows/sections/SectionPS.cc
+++ b/agents/windows/sections/SectionPS.cc
@@ -29,6 +29,7 @@
#include "PerfCounter.h"
#include "SectionHeader.h"
#include "dynamic_func.h"
+#include "win_error.h"
namespace {
@@ -296,11 +297,14 @@ bool SectionPS::outputNative(std::ostream &out) {
FILETIME createTime, exitTime, kernelTime, userTime;
ULARGE_INTEGER kernelmodetime, usermodetime;
if (_winapi.GetProcessTimes(hProcess.get(), &createTime, &exitTime,
- &kernelTime, &userTime) != -1) {
+ &kernelTime, &userTime) != 0) {
kernelmodetime.LowPart = kernelTime.dwLowDateTime;
kernelmodetime.HighPart = kernelTime.dwHighDateTime;
usermodetime.LowPart = userTime.dwLowDateTime;
usermodetime.HighPart = userTime.dwHighDateTime;
+ } else {
+ Error(_logger) << "GetProcessTimes failed: "
+ << get_win_error_as_string(_winapi);
}
DWORD processHandleCount = 0;