diff options
| author | Luna <git@l4.pm> | 2020-03-29 17:45:43 -0300 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-06-02 14:56:06 -0400 |
| commit | 901aab8761daa5c2dae5e470d51f5b3bf76e2b78 (patch) | |
| tree | 1eabd2f34ad7c2a77b1d6b511264197ce0912b92 | |
| parent | 2c641c93da1babed3d53bf705f3d6a84414512e7 (diff) | |
| download | zig-901aab8761daa5c2dae5e470d51f5b3bf76e2b78.tar.gz zig-901aab8761daa5c2dae5e470d51f5b3bf76e2b78.zip | |
Add ioctl errors
| -rw-r--r-- | lib/std/net.zig | 13 |
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 { |
