From nobody Sun Feb 8 17:37:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1659712867; cv=none; d=zohomail.com; s=zohoarc; b=Z1YXoPan4NZuBcMsj4kYTmN/6SuJijv5QyEEmZru7pMzwG89pfu83aU2ZRne0DyXk+Q2MUHdtMQbh6I6JeEROTmTDeWK4OB6kzYaYWiaOFI67zWqENdvnJu49lEOrudMW0efULoExgk8m6ZPJenLL4ptO2OWzp2SH0GJKG2bVpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659712867; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UOT/8lZvPj0pecATGxp5bq0muJCXkI4mu9fSpzeFelo=; b=jj6KMbH/PeiTTkoLBlYK8kYUk8U50I6D1wJBAAdzSrt0rHTTJ3kDtu8jb/zr52aMLAZzhfTyg86pHYjc5YVwscTB9pq7A4S6kBhjIfz9LD5TjMoQ7KzoMHMaGT6D9E30kmgDTQKTrF0TSbODRzB2fSYMbXNXfygp81HWQxG3MSc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1659712867213688.49966372248; Fri, 5 Aug 2022 08:21:07 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-388-fSEx1fIANJ2FhoSzF02_LQ-1; Fri, 05 Aug 2022 11:20:48 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7D58F3C0F376; Fri, 5 Aug 2022 15:20:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A265C27DB3; Fri, 5 Aug 2022 15:20:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3352D1946A63; Fri, 5 Aug 2022 15:20:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B54B71946A60 for ; Fri, 5 Aug 2022 15:20:43 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9ED722026987; Fri, 5 Aug 2022 15:20:43 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.194.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id B25732026D4C; Fri, 5 Aug 2022 15:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659712865; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=UOT/8lZvPj0pecATGxp5bq0muJCXkI4mu9fSpzeFelo=; b=B1KO6b6PsxBYV1UYyrEqG0XQxtg+YpvNd4WSNPiIaQPzJG2+HQoSTCyumj8C3iBs2CACB2 AlzOc6yMAwXpSnceZepawiCVvtHms92c2ZRzfJOYuwQgkI0Dei2ipCdMqSKcElEbXWBizP zZ6WPlgX2K78dOQTEEzAvJk9SYw/ugk= X-MC-Unique: fSEx1fIANJ2FhoSzF02_LQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 6/6] util/qemu-sockets: Replace the call to close a socket with closesocket() Date: Fri, 5 Aug 2022 16:20:14 +0100 Message-Id: <20220805152014.135768-7-berrange@redhat.com> In-Reply-To: <20220805152014.135768-1-berrange@redhat.com> References: <20220805152014.135768-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , Bin Meng , Beraldo Leal , David Hildenbrand , libvir-list@redhat.com, Cornelia Huck , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659712867835100001 From: Bin Meng close() is a *nix function. It works on any file descriptor, and sockets in *nix are an example of a file descriptor. closesocket() is a Windows-specific function, which works only specifically with sockets. Sockets on Windows do not use *nix-style file descriptors, and socket() returns a handle to a kernel object instead, so it must be closed with closesocket(). In QEMU there is already a logic to handle such platform difference in os-posix.h and os-win32.h, that: * closesocket maps to close on POSIX * closesocket maps to a wrapper that calls the real closesocket() on Windows Replace the call to close a socket with closesocket() instead. Signed-off-by: Bin Meng Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Daniel P. Berrang=C3=A9 --- util/qemu-sockets.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 13b5b197f9..0e2298278f 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -487,7 +487,7 @@ int inet_connect_saddr(InetSocketAddress *saddr, Error = **errp) =20 if (ret < 0) { error_setg_errno(errp, errno, "Unable to set KEEPALIVE"); - close(sock); + closesocket(sock); return -1; } } @@ -1050,7 +1050,7 @@ static int unix_connect_saddr(UnixSocketAddress *sadd= r, Error **errp) return sock; =20 err: - close(sock); + closesocket(sock); return -1; } =20 --=20 2.37.1