From 7346b4343d81fef12b89a47c6ee4173e97fb497a Mon Sep 17 00:00:00 2001 From: AnErrupTion Date: Sun, 5 Jul 2026 21:09:04 +0200 Subject: [PATCH] Set default capacity to -1 Signed-off-by: AnErrupTion --- src/main.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 0e99915..b51b55a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2320,7 +2320,7 @@ fn getBatteryPercentage(io: std.Io, battery_id: []const u8) !u8 { // battery_id is unused on FreeBSD; sysctl exposes a single aggregate value. // For multi-battery systems the MIB would be hw.acpi.battery.N.life, // but hw.acpi.battery.life is the standard single-battery interface. - var capacity: c_int = undefined; + var capacity: c_int = -1; var size: usize = @sizeOf(c_int); const ret = sysctl.sysctlbyname("hw.acpi.battery.life", &capacity, &size, null, 0);