Skip to content

Commit

Permalink
fix incorrect flags being set in os.setSockFlags
Browse files Browse the repository at this point in the history
fixes networking stuff on darwin
  • Loading branch information
andrewrk committed May 5, 2020
1 parent e695568 commit 0a21046
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/std/os.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 0a21046

Please sign in to comment.