git: cd5e0d8a5152 - main - deskutils/i3status: fix disk size computation
Date: Fri, 20 Sep 2024 09:58:01 UTC
The branch main has been updated by bapt:
URL: https://cgit.FreeBSD.org/ports/commit/?id=cd5e0d8a5152961e09d29f3adfc0aec0c3a0d840
commit cd5e0d8a5152961e09d29f3adfc0aec0c3a0d840
Author: Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-09-20 09:53:59 +0000
Commit: Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-09-20 09:55:04 +0000
deskutils/i3status: fix disk size computation
---
deskutils/i3status/Makefile | 1 +
.../i3status/files/patch-src_print__disk__info.c | 27 ++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/deskutils/i3status/Makefile b/deskutils/i3status/Makefile
index ac092d08f292..147ff2732704 100644
--- a/deskutils/i3status/Makefile
+++ b/deskutils/i3status/Makefile
@@ -1,5 +1,6 @@
PORTNAME= i3status
PORTVERSION= 2.15
+PORTREVISION= 1
CATEGORIES= deskutils
MASTER_SITES= http://i3wm.org/i3status/
diff --git a/deskutils/i3status/files/patch-src_print__disk__info.c b/deskutils/i3status/files/patch-src_print__disk__info.c
new file mode 100644
index 000000000000..e81b89e4e05d
--- /dev/null
+++ b/deskutils/i3status/files/patch-src_print__disk__info.c
@@ -0,0 +1,27 @@
+--- src/print_disk_info.c.orig 2024-08-19 16:28:44 UTC
++++ src/print_disk_info.c
+@@ -73,13 +73,13 @@ static bool below_threshold(struct statvfs buf, const
+ } else if (strcasecmp(threshold_type, "percentage_avail") == 0) {
+ return 100.0 * (double)buf.f_bavail / (double)buf.f_blocks < low_threshold;
+ } else if (strcasecmp(threshold_type, "bytes_free") == 0) {
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
++#if defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
+ return (double)buf.f_bsize * (double)buf.f_bfree < low_threshold;
+ #else
+ return (double)buf.f_frsize * (double)buf.f_bfree < low_threshold;
+ #endif
+ } else if (strcasecmp(threshold_type, "bytes_avail") == 0) {
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
++#if defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
+ return (double)buf.f_bsize * (double)buf.f_bavail < low_threshold;
+ #else
+ return (double)buf.f_frsize * (double)buf.f_bavail < low_threshold;
+@@ -198,7 +198,7 @@ void print_disk_info(disk_info_ctx_t *ctx) {
+ char string_percentage_used[STRING_SIZE];
+ char string_percentage_avail[STRING_SIZE];
+
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
++#if defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
+ print_bytes_human(string_free, (uint64_t)buf.f_bsize * (uint64_t)buf.f_bfree, ctx->prefix_type);
+ print_bytes_human(string_used, (uint64_t)buf.f_bsize * ((uint64_t)buf.f_blocks - (uint64_t)buf.f_bfree), ctx->prefix_type);
+ print_bytes_human(string_total, (uint64_t)buf.f_bsize * (uint64_t)buf.f_blocks, ctx->prefix_type);