summaryrefslogtreecommitdiff
path: root/src/components/utils/src/resource_usage.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/utils/src/resource_usage.cc')
-rw-r--r--src/components/utils/src/resource_usage.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/components/utils/src/resource_usage.cc b/src/components/utils/src/resource_usage.cc
index 62c8d25b82..aaa9c1b4a7 100644
--- a/src/components/utils/src/resource_usage.cc
+++ b/src/components/utils/src/resource_usage.cc
@@ -124,8 +124,6 @@ bool Resources::GetProcInfo(Resources::PidStats& output) {
if (0 >= fd) {
LOG4CXX_ERROR(logger_, "Failed open process proc file : " << GetProcPath() <<
"; error no : " << strerror( errno ) );
-
- close(fd);
return false;
}
devctl(fd, DCMD_PROC_INFO, &output, sizeof(output), 0);
@@ -150,14 +148,14 @@ bool Resources::GetMemInfo(Resources::MemInfo &output) {
std::string as_path = GetStatPath();
struct stat st;
struct _dir* proc_dir = 0;
+ struct dirent* proc_entry = 0;
if (0 == (proc_dir = opendir(proc))) {
LOG4CXX_ERROR(logger_, "Unable to access to " << proc);
result = false;
return result;
}
- if (0 == readdir(proc_dir)) {
+ if (0 == (proc_entry = readdir(proc_dir))) {
LOG4CXX_ERROR(logger_, "Unable to read : " << proc_dir);
- closedir(proc_dir);
result = false;
return result;
}