summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichaelbuch12@gmail.com <michaelbuch12@gmail.com>2021-01-01 17:04:36 +0100
committerRafael Marçalo <raroma09@gmail.com>2022-10-27 12:58:33 +0100
commit234dd3d5db6217cb49880a924e27509080a7f661 (patch)
tree178b2cec048dd6b71db2a8f47f3e0c8d25c46c99
parentcc0b22ed267ad99447049fdc07c5b5fee04c7f7c (diff)
Fix RAM component on FreeBSD
The current implementation uses the wrong type for given sysctl calls leading to overflow and incorrectly reported RAM usage. The fix is to use 'unsigned int' which is what FreeBSD expects.
-rw-r--r--components/ram.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/ram.c b/components/ram.c
index 47e6fda..6040e56 100644
--- a/components/ram.c
+++ b/components/ram.c
@@ -178,7 +178,7 @@
const char *
ram_total(void) {
- long npages;
+ unsigned int npages;
size_t len;
len = sizeof(npages);
@@ -191,8 +191,8 @@
const char *
ram_perc(void) {
- long npages;
- long active;
+ unsigned int npages;
+ unsigned int active;
size_t len;
len = sizeof(npages);
@@ -209,7 +209,7 @@
const char *
ram_used(void) {
- long active;
+ unsigned int active;
size_t len;
len = sizeof(active);