commit 0a2104689b4c3c686f2268b5053ad38fd01c1d55 (tree)
parent e6955688ac2255d3813e8d2994b6661bc651369b
Author: Andrew Kelley <andrew@ziglang.org>
Date: Tue, 5 May 2020 12:45:39 -0400
fix incorrect flags being set in os.setSockFlags
fixes networking stuff on darwin
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/std/os.zig b/lib/std/os.zig
@@ -3283,7 +3283,7 @@ fn setSockFlags(fd: fd_t, flags: u32) !void {
error.Locked => unreachable,
else => |e| return e,
};
- if ((flags & SOCK_NONBLOCK) != 0) fd_flags |= FD_CLOEXEC;
+ if ((flags & SOCK_CLOEXEC) != 0) fd_flags |= FD_CLOEXEC;
_ = fcntl(fd, F_SETFD, fd_flags) catch |err| switch (err) {
error.FileBusy => unreachable,
error.Locked => unreachable,
@@ -3296,7 +3296,7 @@ fn setSockFlags(fd: fd_t, flags: u32) !void {
error.Locked => unreachable,
else => |e| return e,
};
- if ((flags & SOCK_CLOEXEC) != 0) fl_flags |= O_NONBLOCK;
+ if ((flags & SOCK_NONBLOCK) != 0) fl_flags |= O_NONBLOCK;
_ = fcntl(fd, F_SETFL, fl_flags) catch |err| switch (err) {
error.FileBusy => unreachable,
error.Locked => unreachable,