From 50e6a27c297bf73d97b1b4bb46c5529f5495ab8f Mon Sep 17 00:00:00 2001 From: Luna Date: Sun, 1 Dec 2019 13:17:52 -0300 Subject: [PATCH] std.net: fix setsockopt call --- lib/std/net.zig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/std/net.zig b/lib/std/net.zig index 531900cf9..a7c6797de 100644 --- a/lib/std/net.zig +++ b/lib/std/net.zig @@ -1326,13 +1326,12 @@ pub const StreamServer = struct { } if (self.reuse_address) { - var optval: c_int = 1; + var opt = [_]u8{1} ** @sizeOf(c_int); try os.setsockopt( self.sockfd.?, os.SOL_SOCKET, os.SO_REUSEADDR, - @ptrCast([*]const u8, &optval), - @sizeOf(c_int), + &opt, ); }