From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 1293B5A028C for ; Thu, 17 Nov 2022 06:59:23 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4NCTkl5QqKz4xyZ; Thu, 17 Nov 2022 16:59:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1668664751; bh=PtDhn7E+g+iP0l5ScoUmAdcKdaOyUgDoDROqcfS1GgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KkubeNkd6bM57lj01KW2azoUrcAufGdmvh3zLuXFqzApU/0fslJkPEOtoc6+JDSHg dcziNBdEv/iXbOLDK+843VB8SeabKZCbZzGCSG8JQhH1yUQCy6GdMz1n5+yE2bxeQG 09oeJRzOTHtbKtdAlPPTZkBv1hPSSh8pUaBV3OmM= From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 31/32] util: Always return -1 on error in sock_l4() Date: Thu, 17 Nov 2022 16:59:07 +1100 Message-Id: <20221117055908.2782981-32-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117055908.2782981-1-david@gibson.dropbear.id.au> References: <20221117055908.2782981-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 2HR7IG2YAIXYSFZ2K5CNZ2QUELAONYPF X-Message-ID-Hash: 2HR7IG2YAIXYSFZ2K5CNZ2QUELAONYPF X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.c b/util.c index 59c6641..d9858f2 100644 --- a/util.c +++ b/util.c @@ -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; -- 2.38.1