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);