2zw

fix compilation error on openbsd

39c50c61e5d0de9d304e5a5cf8ca814652144104

SM <seb.michalk@gmail.com>

2026-01-09 21:21:39 +0000

 src/bar.zig | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/bar.zig b/src/bar.zig
index cb2ee02..4be70bc 100644
--- a/src/bar.zig
+++ b/src/bar.zig
@@ -21,7 +21,7 @@
 // SOFTWARE.
 
 const std = @import("std");
-const os = std.os;
+const c = std.c;
 const builtin = @import("builtin");
 const ArrayList = std.array_list.Managed;
 const C = @import("c.zig").C;
@@ -516,12 +516,17 @@ fn readbat_openbsd(alloc: std.mem.Allocator) !u8 {
 fn reapChild(pid: std.posix.pid_t) void {
     var status: c_int = 0;
     while (true) {
-        const rc = os.system.waitpid(pid, &status, 0);
-        switch (std.posix.errno(rc)) {
-            .SUCCESS => return,
-            .INTR => continue,
-            .CHILD => return,
-            else => return,
+        const rc = c.waitpid(pid, &status, 0);
+        if (rc == pid) return;
+        if (rc == 0) continue;
+        if (rc == -1) {
+            switch (std.posix.errno(rc)) {
+                .INTR => continue,
+                .CHILD => return,
+                else => return,
+            }
+        } else {
+            return;
         }
     }
 }