From nobody Fri May 3 08:25:06 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597832283; cv=none; d=zohomail.com; s=zohoarc; b=CDATFunoZRS3X3XKhAUHLfxz5y0GauQ13BjPTKZwyrvTVMfJuox9deuW0GZowLiQxIr3304SDZofcohlBDExIDywfxKHQ79u7S9UcR30dl6SHJ3POXcacVU3GizccnqX/AGyfVmqcFF7WVneZDdv7Tzx9F2v6I4/CrT70FQGey0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597832283; 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=W7Cy1N6CprPxZQt1Q47SwdBdvok6+NBZlfKcN5+11tE=; b=RQfP8ji4PT7ew1P812w9DTDLA0TJXi0Jq5M4tnNEUZX/IrRmj3n3c5AVoforzK5Jupfj9wAtNtktUIRpzuP1EWUiSN32WD0NFYyf1QkgX8pedVkHmeRSJObgAQMFbQQDx6YqPBpBnV90+0nVuQ1wXE7Uqgr2nhpBSYiK5yYV4U0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1597832283713262.0933018682829; Wed, 19 Aug 2020 03:18:03 -0700 (PDT) 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-19-28dJjRynPrCOjhhHWOmVHg-1; Wed, 19 Aug 2020 06:17:21 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 170ED18B9F85; Wed, 19 Aug 2020 10:17:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E889410013C4; Wed, 19 Aug 2020 10:17:14 +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 A43D5180B656; Wed, 19 Aug 2020 10:17:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07JAALXW026756 for ; Wed, 19 Aug 2020 06:10:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id D78E61112876; Wed, 19 Aug 2020 10:10:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CAE7F100892D for ; Wed, 19 Aug 2020 10:10:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB2B4101AA41 for ; Wed, 19 Aug 2020 10:10:19 +0000 (UTC) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-527-4sg_Y9JlM8ykoiKIylRwsA-1; Wed, 19 Aug 2020 06:10:17 -0400 Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 58687F2CD6; Wed, 19 Aug 2020 10:04:01 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 822C0F2CD4; Wed, 19 Aug 2020 10:04:00 +0000 (UTC) X-MC-Unique: 28dJjRynPrCOjhhHWOmVHg-1 X-MC-Unique: 4sg_Y9JlM8ykoiKIylRwsA-1 From: Natanael Copa To: libvir-list@redhat.com Subject: [PATCH 1/2] util: avoid free() when reset log after fork Date: Wed, 19 Aug 2020 12:03:40 +0200 Message-Id: <20200819100341.31374-2-ncopa@alpinelinux.org> In-Reply-To: <20200819100341.31374-1-ncopa@alpinelinux.org> References: <20200819100341.31374-1-ncopa@alpinelinux.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 07JAALXW026756 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 19 Aug 2020 06:17:13 -0400 Cc: Natanael Copa 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Doing malloc/free after fork is techincally not allowed in POSIX and deadlocks[1] with musl libc. [1]: https://gitlab.com/libvirt/libvirt/-/issues/52 Signed-off-by: Natanael Copa --- src/util/vircommand.c | 4 ++-- src/util/virlog.c | 44 +++++++++++++++++++++++++++++++++---------- src/util/virlog.h | 1 + 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 76f7eb9a3d..17e5bb00d3 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -304,7 +304,7 @@ virFork(void) /* Make sure any hook logging is sent to stderr, since child * process may close the logfile FDs */ logprio =3D virLogGetDefaultPriority(); - virLogReset(); + virLogResetWithoutFree(); virLogSetDefaultPriority(logprio); =20 /* Clear out all signal handlers from parent so nothing @@ -861,7 +861,7 @@ virExec(virCommandPtr cmd) goto fork_error; =20 /* Close logging again to ensure no FDs leak to child */ - virLogReset(); + virLogResetWithoutFree(); =20 if (cmd->env) execve(binary, cmd->args, cmd->env); diff --git a/src/util/virlog.c b/src/util/virlog.c index 3217e5eb73..3959de5ca7 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -108,8 +108,8 @@ static size_t virLogNbOutputs; */ static virLogPriority virLogDefaultPriority =3D VIR_LOG_DEFAULT; =20 -static void virLogResetFilters(void); -static void virLogResetOutputs(void); +static void virLogResetFilters(bool freemem); +static void virLogResetOutputs(bool freemem); static void virLogOutputToFd(virLogSourcePtr src, virLogPriority priority, const char *filename, @@ -284,8 +284,30 @@ virLogReset(void) return -1; =20 virLogLock(); - virLogResetFilters(); - virLogResetOutputs(); + virLogResetFilters(true); + virLogResetOutputs(true); + virLogDefaultPriority =3D VIR_LOG_DEFAULT; + virLogUnlock(); + return 0; +} + +/** + * virLogResetWithoutFree: + * + * Reset the logging module to its default initial state, but avoid doing + * free() so it can be used after fork and before exec. + * + * Returns 0 if successful, and -1 in case or error + */ +int +virLogResetWithoutFree(void) +{ + if (virLogInitialize() < 0) + return -1; + + virLogLock(); + virLogResetFilters(false); + virLogResetOutputs(false); virLogDefaultPriority =3D VIR_LOG_DEFAULT; virLogUnlock(); return 0; @@ -324,9 +346,10 @@ virLogSetDefaultPriority(virLogPriority priority) * Removes the set of logging filters defined. */ static void -virLogResetFilters(void) +virLogResetFilters(bool freemem) { - virLogFilterListFree(virLogFilters, virLogNbFilters); + if (freemem) + virLogFilterListFree(virLogFilters, virLogNbFilters); virLogFilters =3D NULL; virLogNbFilters =3D 0; virLogFiltersSerial++; @@ -371,9 +394,10 @@ virLogFilterListFree(virLogFilterPtr *list, int count) * Removes the set of logging output defined. */ static void -virLogResetOutputs(void) +virLogResetOutputs(bool freemem) { - virLogOutputListFree(virLogOutputs, virLogNbOutputs); + if (freemem) + virLogOutputListFree(virLogOutputs, virLogNbOutputs); virLogOutputs =3D NULL; virLogNbOutputs =3D 0; } @@ -1392,7 +1416,7 @@ virLogDefineOutputs(virLogOutputPtr *outputs, size_t = noutputs) return -1; =20 virLogLock(); - virLogResetOutputs(); + virLogResetOutputs(true); =20 #if HAVE_SYSLOG_H /* syslog needs to be special-cased, since it keeps the fd in private = */ @@ -1435,7 +1459,7 @@ virLogDefineFilters(virLogFilterPtr *filters, size_t = nfilters) return -1; =20 virLogLock(); - virLogResetFilters(); + virLogResetFilters(true); virLogFilters =3D filters; virLogNbFilters =3D nfilters; virLogUnlock(); diff --git a/src/util/virlog.h b/src/util/virlog.h index 984a9d5a43..69f7b1ef94 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -168,6 +168,7 @@ void virLogSetDefaultOutput(const char *fname, bool god= aemon, bool privileged); void virLogLock(void); void virLogUnlock(void); int virLogReset(void); +int virLogResetWithoutFree(void); int virLogParseDefaultPriority(const char *priority); int virLogPriorityFromSyslog(int priority); void virLogMessage(virLogSourcePtr source, --=20 2.28.0 From nobody Fri May 3 08:25:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597832244; cv=none; d=zohomail.com; s=zohoarc; b=WeqW4P22nJ38zOXMWsHlKmG2q8REFY5sebOmXRp/z9022ZuLr1An3Qh1qEIjAI035t9w/L+VzTEh3yLNs7jmzQ0xdksJsFBYMYkb9cpOQpwuc7sTOysZIlpA6hOSUY7waI/fZavP989Wsc6e01c9EPDQDGsR3Rc2K9uUob8j40I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597832244; 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=YO6eT10WjK82nJVkMuzMRfkt2KEyahN0FKHPHIkV8g4=; b=J6LETvgLBqoXhQrpnwGZZ3t8i6dxBdMcH2h0gyd3bEq+3ulboYS7jC1GqxofT86IcovYcraiBzLaw4LIcyEzCZgc5ja+DpVcZB+AYSMEMXvskMBdnDuzLU/ggUQFfea38wyh+OB0F+1G4jLUr8b2XqGhqPQb8aXFFaUJ15rq+Ak= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1597832244786744.4673667072849; Wed, 19 Aug 2020 03:17:24 -0700 (PDT) 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-19-t_bf49zUNjOnZG7y1H813w-1; Wed, 19 Aug 2020 06:17:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F22EF57052; Wed, 19 Aug 2020 10:17:14 +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 D3DDF600DD; Wed, 19 Aug 2020 10:17:14 +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 98FA34EE1D; Wed, 19 Aug 2020 10:17:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07JAARgI026770 for ; Wed, 19 Aug 2020 06:10:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9E853A9E7B; Wed, 19 Aug 2020 10:10:27 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9867AB5523 for ; Wed, 19 Aug 2020 10:10:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C114C984BAE for ; Wed, 19 Aug 2020 10:10:24 +0000 (UTC) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-495-mjpo9sITOJG6PX8Y2BlkfA-1; Wed, 19 Aug 2020 06:10:17 -0400 Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 5D04FF2CDA; Wed, 19 Aug 2020 10:04:02 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 90829F2CD8; Wed, 19 Aug 2020 10:04:01 +0000 (UTC) X-MC-Unique: t_bf49zUNjOnZG7y1H813w-1 X-MC-Unique: mjpo9sITOJG6PX8Y2BlkfA-1 From: Natanael Copa To: libvir-list@redhat.com Subject: [PATCH 2/2] util: command: improve generic mass close of fds Date: Wed, 19 Aug 2020 12:03:41 +0200 Message-Id: <20200819100341.31374-3-ncopa@alpinelinux.org> In-Reply-To: <20200819100341.31374-1-ncopa@alpinelinux.org> References: <20200819100341.31374-1-ncopa@alpinelinux.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 07JAARgI026770 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 19 Aug 2020 06:17:13 -0400 Cc: Natanael Copa 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a portable generic implementation of virMassClose as fallback on non-FreeBSD and non-glibc. This implementation uses poll(2) to look for open files to keep performance reasonable while not using any mallocs. This solves a deadlock with musl libc. Signed-off-by: Natanael Copa --- src/util/vircommand.c | 76 +++++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 18 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 17e5bb00d3..06579cfb44 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -443,7 +443,7 @@ virExecCommon(virCommandPtr cmd, gid_t *groups, int ngr= oups) return 0; } =20 -# ifdef __linux__ +# if defined(__linux__) && defined(__GLIBC__) /* On Linux, we can utilize procfs and read the table of opened * FDs and selectively close only those FDs we don't want to pass * onto child process (well, the one we will exec soon since this @@ -482,17 +482,7 @@ virCommandMassCloseGetFDsLinux(virCommandPtr cmd G_GNU= C_UNUSED, VIR_DIR_CLOSE(dp); return ret; } - -# else /* !__linux__ */ - -static int -virCommandMassCloseGetFDsGeneric(virCommandPtr cmd G_GNUC_UNUSED, - virBitmapPtr fds) -{ - virBitmapSetAll(fds); - return 0; -} -# endif /* !__linux__ */ +# endif /* __linux__ && __GLIBC__ */ =20 # ifdef __FreeBSD__ =20 @@ -546,7 +536,7 @@ virCommandMassClose(virCommandPtr cmd, return 0; } =20 -# else /* ! __FreeBSD__ */ +# elif defined(__GLIBC_) /* ! __FreeBSD__ */ =20 static int virCommandMassClose(virCommandPtr cmd, @@ -574,13 +564,8 @@ virCommandMassClose(virCommandPtr cmd, if (!(fds =3D virBitmapNew(openmax))) return -1; =20 -# ifdef __linux__ if (virCommandMassCloseGetFDsLinux(cmd, fds) < 0) return -1; -# else - if (virCommandMassCloseGetFDsGeneric(cmd, fds) < 0) - return -1; -# endif =20 fd =3D virBitmapNextSetBit(fds, 2); for (; fd >=3D 0; fd =3D virBitmapNextSetBit(fds, fd)) { @@ -598,6 +583,61 @@ virCommandMassClose(virCommandPtr cmd, return 0; } =20 +#else /* ! __FreeBSD__ && ! __GLIBC__ */ +static int +virCommandMassClose(virCommandPtr cmd, + int childin, + int childout, + int childerr) +{ + static struct pollfd pfds[1024]; + int fd =3D 0; + int i, total; + int max_fd =3D sysconf(_SC_OPEN_MAX); + + if (max_fd < 0) { + virReportSystemError(errno, "%s", _("sysconf(_SC_OPEN_MAX) failed"= )); + return -1; + } + + total =3D max_fd - fd; + for (i =3D 0; i < (total < 1024 ? total : 1024); i++) + pfds[i].events =3D 0; + + while (fd < max_fd) { + int nfds, r =3D 0; + + total =3D max_fd - fd; + nfds =3D total < 1024 ? total : 1024; + + for (i =3D 0; i < nfds; i++) + pfds[i].fd =3D fd + i; + + do { + r =3D poll(pfds, nfds, 0); + } while (r =3D=3D -1 && errno =3D=3D EINTR); + + if (r < 0) { + virReportSystemError(errno, "%s", _("poll() failed")); + return -1; + } + + for (i =3D 0; i < nfds; i++) + if (pfds[i].revents !=3D POLLNVAL) { + if (pfds[i].fd =3D=3D childin || pfds[i].fd =3D=3D childou= t || pfds[i].fd =3D=3D childerr) + continue; + if (!virCommandFDIsSet(cmd, pfds[i].fd)) { + VIR_MASS_CLOSE(pfds[i].fd); + } else if (virSetInherit(pfds[i].fd, true) < 0) { + virReportSystemError(errno, _("failed to preserve fd %= d"), pfds[i].fd); + return -1; + } + } + fd +=3D nfds; + } + return 0; +} + # endif /* ! __FreeBSD__ */ =20 /* --=20 2.28.0