authorgravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-09-19 18:29:50+02:00
committergravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-09-19 18:29:50+02:00
log92407bfcd7b65f153b7523d97ac5f69193561d27
tree41d15a0160b733d074d948bc89f0e68ee20859c1
parentba18420b277a8de21a760387767dcf2c9227cc5a

Upgrade check_errno() to an exhaustive switch (safer)


1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/os/linux/io_uring.zig+4-4
...@@ -608,10 +608,10 @@ pub const CompletionQueue = struct {...@@ -608,10 +608,10 @@ pub const CompletionQueue = struct {
608};608};
609609
610inline fn check_errno(res: usize) !void {610inline fn check_errno(res: usize) !void {
611 const errno = linux.getErrno(res);611 switch (linux.getErrno(res)) {
612 if (errno != 0) {612 0 => return,
613 if (errno == linux.ENOSYS) return error.UnsupportedKernel;613 linux.ENOSYS => return error.UnsupportedKernel,
614 return os.unexpectedErrno(errno);614 else => |errno| return os.unexpectedErrno(errno)
615 }615 }
616}616}
617617