From 172b3b2968831cff3425c030a7dfdc18171e7f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 1 Aug 2023 16:09:20 +0800 Subject: [PATCH] Disk (BSD): fix bytesUsed calculation Follow up of #508 --- CHANGELOG.md | 1 + src/detection/disk/disk_bsd.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fe24264..9267e211 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Bugfixes: * Properly detect CPU on POWER (CPU, Linux) * Fix compatibility with Fig (Terminal, macOS) * Fix option `--title-fqdn` doesn't work (Title) +* Fix used spaces calculation (Disk, Linux / BSD / macOS, #508) Logo: * Change the special handling of `kitty` protocol with `.png` image file to a new image protocol `kitty-direct`. This is the fastest image protocol because fastfetch doesn't need to pre-encode the image to base64 or something and the image content doesn't need to be transmitted via tty. Note: diff --git a/src/detection/disk/disk_bsd.c b/src/detection/disk/disk_bsd.c index e9911eb7..746a1705 100644 --- a/src/detection/disk/disk_bsd.c +++ b/src/detection/disk/disk_bsd.c @@ -45,7 +45,7 @@ const char* ffDetectDisksImpl(FFlist* disks) #endif disk->bytesTotal = fs->f_blocks * fs->f_bsize; - disk->bytesUsed = disk->bytesTotal - ((uint64_t)fs->f_bavail * fs->f_bsize); + disk->bytesUsed = disk->bytesTotal - ((uint64_t)fs->f_bfree * fs->f_bsize); disk->filesTotal = (uint32_t) fs->f_files; disk->filesUsed = (uint32_t) (disk->filesTotal - (uint64_t)fs->f_ffree);