From nobody Mon Feb 9 08:55:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1579779913; cv=none; d=zohomail.com; s=zohoarc; b=fOBE7MxYkP+506B1RBDHD0agcEm8ko8iKXUgoa2PAUJ+7kdIVWWtWpWqBtnsCHLS2+iMph2QXeDIETrjpbmPJIUvwz/cxA+eQWxMj8Zv+1FlpNjL3kAx8fQY981UISwc45tG6P/dR3dXDq5y6M/LC8OX3CxnEfxUDOYvkSdDqY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579779913; h=Content-Type:Content-Transfer-Encoding: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=c6DfG4IdZK2csHT9sR4fEQav4+hq7DxMm2nTiRGihzA=; b=FqGqxbLO3MAXA0uPXBGLQhCnvBsHgisISsfxYX7XFQFSs4CiiPpa8kZTrJ62PGcX0IaMcP6XdSlYM9oZiefQTMkUa8pyEHGM/jzg0R4eXwlfKusV65Ku3cV/dgSqg9S696cyDimFBvrJlSzRQPe3vep/FIsI47eacyJVrjfy/Rk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1579779913246466.1427165082283; Thu, 23 Jan 2020 03:45:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-qETfeyS4Na-4kOMF-IwKXw-1; Thu, 23 Jan 2020 06:44:26 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 531911005516; Thu, 23 Jan 2020 11:44:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 223735DDB9; Thu, 23 Jan 2020 11:44:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D1A0985919; Thu, 23 Jan 2020 11:44:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00NBiBna025551 for ; Thu, 23 Jan 2020 06:44:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3CCB2859A9; Thu, 23 Jan 2020 11:44:11 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9647C1CB; Thu, 23 Jan 2020 11:44:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579779912; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=c6DfG4IdZK2csHT9sR4fEQav4+hq7DxMm2nTiRGihzA=; b=c7tu5A+3IqKC4I3AzH2CIrBC2Rnvk2UxHjzhuFnSvO42IlilWJRtjfsKE4NLzqD/J4729F pwIqhT29EXmxbkDQ7OdFJcU/hpts8ugbIiKF1adKV9B6rJrNrD1EmC2qcD9Ba09FvYoyw3 f5U1vEqKwhQJUNq8spzCOzm+VvyNWsE= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 25/32] src: conditionalize use of F_DUPFD_CLOEXEC Date: Thu, 23 Jan 2020 11:43:18 +0000 Message-Id: <20200123114325.3860881-26-berrange@redhat.com> In-Reply-To: <20200123114325.3860881-1-berrange@redhat.com> References: <20200123114325.3860881-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: qETfeyS4Na-4kOMF-IwKXw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The F_DUPFD_CLOEXEC functionality is not available on some platformms. We must thus explicitly call the virSetCloexec function once we remove GNULIB's equiv fix for this. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/rpc/virnetsocket.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 687099720f..906b5165eb 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -1403,15 +1403,27 @@ int virNetSocketDupFD(virNetSocketPtr sock, bool cl= oexec) { int fd; =20 +#ifdef F_DUPFD_CLOEXEC if (cloexec) fd =3D fcntl(sock->fd, F_DUPFD_CLOEXEC, 0); else +#endif /* F_DUPFD_CLOEXEC */ fd =3D dup(sock->fd); if (fd < 0) { virReportSystemError(errno, "%s", _("Unable to copy socket file handle")); return -1; } +#ifndef F_DUPFD_CLOEXEC + if (cloexec && + virSetCloseExec(fd < 0)) { + int saveerr =3D errno; + closesocket(fd); + errno =3D saveerr; + return -1; + } +#endif /* F_DUPFD_CLOEXEC */ + return fd; } =20 --=20 2.24.1