util: Always return -1 on error in sock_l4()

According to its doc comments, sock_l4() returns -1 on error.  It does,
except in one case where it returns -EIO.  Fix this inconsistency to match
the docs and always return -1.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2022-11-17 16:59:07 +11:00 committed by Stefano Brivio
parent 9b0cc33d68
commit 8033a8e889

2
util.c
View file

@ -141,7 +141,7 @@ int sock_l4(const struct ctx *c, int af, uint8_t proto,
if (fd > SOCKET_MAX) {
close(fd);
return -EIO;
return -1;
}
ref.r.s = fd;