| ... | @@ -533,7 +533,18 @@ fn if_nametoindex(name: []const u8) !u32 { | ... | @@ -533,7 +533,18 @@ fn if_nametoindex(name: []const u8) !u32 { |
| 533 | @ptrToInt(&ifr), | 533 | @ptrToInt(&ifr), |
| 534 | ); | 534 | ); |
| 535 | | 535 | |
| 536 | return ifr.ifr_ifru.ifru_ivalue; | 536 | switch (os.errno(rc)) { |
| | 537 | os.EBADF => return error.BadFile, |
| | 538 | os.EINTR => return error.CaughtSignal, |
| | 539 | os.EINVAL => unreachable, |
| | 540 | os.EIO => return error.FileSystem, |
| | 541 | os.ENOTTY => unreachable, |
| | 542 | os.ENXIO => unreachable, |
| | 543 | os.ENODEV => return error.Unsupported, |
| | 544 | else => {}, |
| | 545 | } |
| | 546 | |
| | 547 | return @bitCast(u32, ifr.ifr_ifru.ifru_ivalue); |
| 537 | } | 548 | } |
| 538 | | 549 | |
| 539 | pub const AddressList = struct { | 550 | pub const AddressList = struct { |