Better error handling and debug logging

This commit is contained in:
2026-01-24 18:53:42 -05:00
parent cf365673b5
commit c3b17f8267
2 changed files with 19 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ const Ifconf = extern struct {
};
pub fn init() !RawSocket {
const socket: i32 = @intCast(std.os.linux.socket(std.os.linux.AF.PACKET, std.os.linux.SOCK.RAW, 0));
const socket: i32 = std.math.cast(i32, std.os.linux.socket(std.os.linux.AF.PACKET, std.os.linux.SOCK.RAW, 0)) orelse return error.SocketError;
if (socket < 0) return error.SocketError;
var ifreq_storage: [16]std.os.linux.ifreq = undefined;