Hello! I’m new to Zig and I want to test how easy it is to use C libraries. My first attempt was with FreeBSD’s Capsicum but unfortunately it didn’t end well. Here’s the simple program I wrote:
const std = @import("std");
const capsicum = @cImport({
@cInclude("sys/capsicum.h");
});
pub fn main() !void {
_ = capsicum.cap_enter();
const file = try std.fs.openFileAbsolute("/var/log/debug.log", .{});
defer file.close();
}
When I run zig build run
I get:
unexpected errno: 94
...many times the above...
pid 59514 comm playground has trashed its stack, killing
Error number 94 is ENOTCAPABLE
which is expected but the trashed stack is not.
Is there any mistake? Maybe I’m missing something when it comes to error handling.