From nobody Tue Feb 10 07:42:23 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=red-soft.ru Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 170432816916693.18394428368015; Wed, 3 Jan 2024 16:29:29 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id C852F179F; Wed, 3 Jan 2024 19:29:27 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1E95217D1; Wed, 3 Jan 2024 19:18:07 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id B97BE175D; Wed, 3 Jan 2024 19:17:14 -0500 (EST) Received: from gw.red-soft.ru (red-soft.ru [188.246.186.2]) by lists.libvirt.org (Postfix) with ESMTP id 7A389175D for ; Wed, 3 Jan 2024 19:17:10 -0500 (EST) Received: from gentoo.darknet (unknown [10.81.10.45]) by gw.red-soft.ru (Postfix) with ESMTPA id 7C0FF3E1763; Thu, 4 Jan 2024 03:17:09 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 From: Artem Chernyshev To: devel@lists.libvirt.org Subject: [PATCH 5/7] virprocess: virProcessGetNamespaces() to void Date: Thu, 4 Jan 2024 03:17:01 +0300 Message-ID: <20240104001703.8067-6-artem.chernyshev@red-soft.ru> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240104001703.8067-1-artem.chernyshev@red-soft.ru> References: <20240104001703.8067-1-artem.chernyshev@red-soft.ru> MIME-Version: 1.0 X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 182461 [Jan 03 2024] X-KLMS-AntiSpam-Version: 6.1.0.3 X-KLMS-AntiSpam-Envelope-From: artem.chernyshev@red-soft.ru X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Auth: dkim=none X-KLMS-AntiSpam-Info: LuaCore: 7 0.3.7 6d6bf5bd8eea7373134f756a2fd73e9456bb7d1a, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;red-soft.ru:7.1.1, FromAlignment: s X-MS-Exchange-Organization-SCL: -1 X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiPhishing: Clean, bases: 2024/01/03 22:32:00 X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, bases: 2024/01/03 23:19:00 #22957326 X-KLMS-AntiVirus-Status: Clean, skipped Message-ID-Hash: SYHA46ZW4IKESGUN7H3WO22YAWG7TLXV X-Message-ID-Hash: SYHA46ZW4IKESGUN7H3WO22YAWG7TLXV X-MailFrom: artem.chernyshev@red-soft.ru X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Artem Chernyshev X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704328171505100001 virProcessGetNamespaces() return value is invariant, so change it type and remove all dependent checks. Fixes: 7d2fd6ef01 ("Do not check return value of VIR_EXPAND_N") Signed-off-by: Artem Chernyshev --- src/libvirt-lxc.c | 5 +---- src/lxc/lxc_driver.c | 3 +-- src/qemu/qemu_process.c | 3 +-- src/util/virprocess.c | 4 +--- src/util/virprocess.h | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/libvirt-lxc.c b/src/libvirt-lxc.c index ecc1207ca9..99bb450702 100644 --- a/src/libvirt-lxc.c +++ b/src/libvirt-lxc.c @@ -140,10 +140,7 @@ virDomainLxcEnterNamespace(virDomainPtr domain, =20 if (noldfdlist && oldfdlist) { size_t nfds; - if (virProcessGetNamespaces(getpid(), - &nfds, - oldfdlist) < 0) - goto error; + virProcessGetNamespaces(getpid(), &nfds, oldfdlist); *noldfdlist =3D nfds; } =20 diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 3e9c1395bf..c281998652 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -4691,8 +4691,7 @@ static int lxcDomainLxcOpenNamespace(virDomainPtr dom, goto endjob; } =20 - if (virProcessGetNamespaces(priv->initpid, &nfds, fdlist) < 0) - goto endjob; + virProcessGetNamespaces(priv->initpid, &nfds, fdlist); =20 ret =3D nfds; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 696d526a5d..7770e7e7eb 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2737,8 +2737,7 @@ qemuProcessStartPRDaemonHook(void *opaque) int ret =3D -1; =20 if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) { - if (virProcessGetNamespaces(vm->pid, &nfds, &fds) < 0) - return ret; + virProcessGetNamespaces(vm->pid, &nfds, &fds); =20 if (nfds > 0 && virProcessSetNamespaces(nfds, fds) < 0) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index b6fb17db83..74233e2169 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -652,7 +652,7 @@ int virProcessGetPids(pid_t pid, size_t *npids, pid_t *= *pids) } =20 =20 -int virProcessGetNamespaces(pid_t pid, +void virProcessGetNamespaces(pid_t pid, size_t *nfdlist, int **fdlist) { @@ -673,8 +673,6 @@ int virProcessGetNamespaces(pid_t pid, (*fdlist)[(*nfdlist)-1] =3D fd; } } - - return 0; } =20 =20 diff --git a/src/util/virprocess.h b/src/util/virprocess.h index 6008cca4af..cc6abc6e4b 100644 --- a/src/util/virprocess.h +++ b/src/util/virprocess.h @@ -70,7 +70,7 @@ int virProcessGetPids(pid_t pid, size_t *npids, pid_t **p= ids); int virProcessGetStartTime(pid_t pid, unsigned long long *timestamp); =20 -int virProcessGetNamespaces(pid_t pid, +void virProcessGetNamespaces(pid_t pid, size_t *nfdlist, int **fdlist); =20 --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org