When net_init_tap() succeeds for a multi-queue device, it returns a non-zero ret=1 code to its caller, because of this code where ret becomes 1 when g_unix_set_fd_nonblocking succeeds. Luckily, the only current call site checks for negative, rather than non-zero.
ret = g_unix_set_fd_nonblocking(fd, true, NULL); if (!ret) { ... goto free_fail; Also, if g_unix_set_fd_nonblocking fails (though unlikely), ret=0 is returned, and the caller will use a broken interface. Fixes: a8208626ba89.. ("net: replace qemu_set_nonblock()") Signed-off-by: Steve Sistare <steven.sist...@oracle.com> --- net/tap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/tap.c b/net/tap.c index 1bf085d..1f3e927 100644 --- a/net/tap.c +++ b/net/tap.c @@ -906,8 +906,8 @@ int net_init_tap(const Netdev *netdev, const char *name, goto free_fail; } - ret = g_unix_set_fd_nonblocking(fd, true, NULL); - if (!ret) { + if (!g_unix_set_fd_nonblocking(fd, true, NULL)) { + ret = -1; error_setg_errno(errp, errno, "%s: Can't use file descriptor %d", name, fd); goto free_fail; -- 1.8.3.1