From a0b888b5e6fa81422d05ff7c571e3b0c3871e901 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Thu, 17 Jan 2019 00:05:36 +0100
Subject: [PATCH] fix(fs): Calculate free bytes properly
Seems this was missed in a682d2af91881fa775e265520f7f820cb71dc707
This is now also consistent with what df does
Closes #743
---
include/modules/fs.hpp | 8 ++++----
src/modules/fs.cpp | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/modules/fs.hpp b/include/modules/fs.hpp
index ef6ad71a..0ee56721 100644
--- a/include/modules/fs.hpp
+++ b/include/modules/fs.hpp
@@ -17,10 +17,10 @@ namespace modules {
string type;
string fsname;
- unsigned long long bytes_free{0ULL};
- unsigned long long bytes_used{0ULL};
- unsigned long long bytes_avail{0ULL};
- unsigned long long bytes_total{0ULL};
+ uint64_t bytes_free{0ULL};
+ uint64_t bytes_used{0ULL};
+ uint64_t bytes_avail{0ULL};
+ uint64_t bytes_total{0ULL};
int percentage_free{0};
int percentage_used{0};
diff --git a/src/modules/fs.cpp b/src/modules/fs.cpp
index 44b87cd1..cb5df8bf 100644
--- a/src/modules/fs.cpp
+++ b/src/modules/fs.cpp
@@ -98,7 +98,7 @@ namespace modules {
// see: http://en.cppreference.com/w/cpp/filesystem/space
mount->bytes_total = buffer.f_frsize * buffer.f_blocks;
- mount->bytes_free = buffer.f_bsize * buffer.f_bfree;
+ mount->bytes_free = buffer.f_frsize * buffer.f_bfree;
mount->bytes_used = mount->bytes_total - mount->bytes_free;
mount->bytes_avail = buffer.f_frsize * buffer.f_bavail;