aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuna <git@l4.pm>2020-03-29 17:45:43 -0300
committerAndrew Kelley <andrew@ziglang.org>2020-06-02 14:56:06 -0400
commit901aab8761daa5c2dae5e470d51f5b3bf76e2b78 (patch)
tree1eabd2f34ad7c2a77b1d6b511264197ce0912b92
parent2c641c93da1babed3d53bf705f3d6a84414512e7 (diff)
downloadzig-901aab8761daa5c2dae5e470d51f5b3bf76e2b78.tar.gz
zig-901aab8761daa5c2dae5e470d51f5b3bf76e2b78.zip
Add ioctl errors
-rw-r--r--lib/std/net.zig13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/std/net.zig b/lib/std/net.zig
index 5cc9a8f740..78ed8bc913 100644
--- a/lib/std/net.zig
+++ b/lib/std/net.zig
@@ -533,7 +533,18 @@ fn if_nametoindex(name: []const u8) !u32 {
@ptrToInt(&ifr),
);
- return ifr.ifr_ifru.ifru_ivalue;
+ switch (os.errno(rc)) {
+ os.EBADF => return error.BadFile,
+ os.EINTR => return error.CaughtSignal,
+ os.EINVAL => unreachable,
+ os.EIO => return error.FileSystem,
+ os.ENOTTY => unreachable,
+ os.ENXIO => unreachable,
+ os.ENODEV => return error.Unsupported,
+ else => {},
+ }
+
+ return @bitCast(u32, ifr.ifr_ifru.ifru_ivalue);
}
pub const AddressList = struct {