]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
io: fix a no-return with -DNDEBUG
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 1 Feb 2018 15:30:26 +0000 (16:30 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 5 Feb 2018 13:04:23 +0000 (14:04 +0100)
daemon/io.c

index 6a59a5ac0b276127823fb750560e4ef536ceacbc..13909a3a1508e5a9e996d3bc6a77a4a1acff25e5 100644 (file)
@@ -459,12 +459,15 @@ void io_release(uv_handle_t *handle)
 
 int io_start_read(uv_handle_t *handle)
 {
-       if (handle->type == UV_UDP) {
+       switch (handle->type) {
+       case UV_UDP:
                return uv_udp_recv_start((uv_udp_t *)handle, &handle_getbuf, &udp_recv);
-       } else if (handle->type == UV_TCP) {
+       case UV_TCP:
                return uv_read_start((uv_stream_t *)handle, &handle_getbuf, &tcp_recv);
+       default:
+               assert(!EINVAL);
+               return kr_error(EINVAL);
        }
-       assert(false);
 }
 
 int io_stop_read(uv_handle_t *handle)