From nobody Sun Apr 28 19:37:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1519780724973997.9346028553024; Tue, 27 Feb 2018 17:18:44 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 30C6E81DED; Wed, 28 Feb 2018 01:18:43 +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 12C4160C82; Wed, 28 Feb 2018 01:18:41 +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 2C9A64A46D; Wed, 28 Feb 2018 01:18:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1S1IZVP032047 for ; Tue, 27 Feb 2018 20:18:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id EC5925C263; Wed, 28 Feb 2018 01:18:35 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E495B5E1AA for ; Wed, 28 Feb 2018 01:18:33 +0000 (UTC) Received: from mail-qk0-f194.google.com (mail-qk0-f194.google.com [209.85.220.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9E278553C for ; Wed, 28 Feb 2018 01:18:32 +0000 (UTC) Received: by mail-qk0-f194.google.com with SMTP id 130so1011953qkd.13 for ; Tue, 27 Feb 2018 17:18:32 -0800 (PST) Received: from localhost.localdomain ([201.74.224.23]) by smtp.gmail.com with ESMTPSA id q128sm334159qkb.83.2018.02.27.17.18.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 17:18:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=UGZgMxdAAa6ud+Fho2phVUa9UH56zfL+rhqLdtBDsQA=; b=gVt6o3SpMdT4xEc/ikDMHg2Q4aTlgECQMI7gr0yBqSASTVOXjlPl6Q+FIgVhz4bcHz TNB9b1x0IBFwe8id31+z5bhUDfoJ5ZdpgiO0h2iarAo6EIyzGcq2/WBSBBg8xcR5exkg zhz7hsI3L1I4zNU0dAmWZUccgMxusIAFiwgys/oWBDRDezL6Yv41bnGWwePEeGFwJBMv 2u0CEjgcEj9l4cxyXXWCHMYZBVXHRLKXw87dYC7ClvSIK76A2FWojRp/V/4dTFC66llY zDx4T+xCPG/K4qoFAlp6JtsNaUeThR3K/GJhLGa8BCeQrEV5y6mUSlRAS8oRAJF5MCOG zpPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=UGZgMxdAAa6ud+Fho2phVUa9UH56zfL+rhqLdtBDsQA=; b=UObZ/7rqzvSgGAxwRM8EsctWo7zmrk1kU9sHPmjsjRherAxbxq71tuRkXxK6BjTrD+ 0S3vwE4yq7JHlLM25C7fVFJa6A+vIjzlsgg56V+/VRqMcktZWHECI4Y7wz9j/6+JFgk2 QDXwsvFsuK7x5ontjhoktUIuz065INx1opnO87Ldh2zGmp/+2Aa10DTcoO1a0vD1f/V4 Gl4z7NHxdUq5o9m3o6yNuIWp8BPmy+hlRq4DY41iW2xc6yll1zvVLREUiPpzWySHxF/o f6QhKQzefgFEnuJG/RlcUGEgr5OsyASbarggqt9jfqka3qpw/awWLWn7rpidCgzFltW5 RNTw== X-Gm-Message-State: APf1xPBCsYhmL3bolA46rSiPwRtvUZmlL0wHHZZmqbu0W6inCzcWXwFc GqdAE71X3CeGTkOoqQzxpJfxFA== X-Google-Smtp-Source: AG47ELuDkIYWKHNfZdEez53xUzCqgGUin0byHP2E9lAuMQr4U0BkmH6wgX5XwprcozvhScoSHgm3JA== X-Received: by 10.55.24.160 with SMTP id 32mr25327888qky.214.1519780711775; Tue, 27 Feb 2018 17:18:31 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Date: Tue, 27 Feb 2018 22:17:54 -0300 Message-Id: <20180228011754.25081-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 28 Feb 2018 01:18:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 28 Feb 2018 01:18:33 +0000 (UTC) for IP:'209.85.220.194' DOMAIN:'mail-qk0-f194.google.com' HELO:'mail-qk0-f194.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.220.194 mail-qk0-f194.google.com 209.85.220.194 mail-qk0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] virsh: fixing segfault by pool autocompleter function. 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 28 Feb 2018 01:18:43 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The commands which requires a pool to perform any action for a volume is throwing a segfault when you pass the volume name before a pool name or without the argument '--pool'. An example that works: virsh # vol-list loops-pool Name Path ------------------------------------------------------------------- loop0 /mnt/loop0 virsh # vol-info --pool loops-pool lo An example that does not work: virsh # vol-list loops-pool Name Path ------------------------------------------------------------------- loop0 /mnt/loop0 virsh # vol-info lo Segmentation Fault The example 'vol-info' can be executed as 'vol-info loop0 --pool loops-pool'. So, this commit fixes this problem when the arguments are inverted and avoids the segfault. Signed-off-by: Julio Faracco --- tools/virsh-pool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 56b6cfc73..24a4d1ee7 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -143,6 +143,9 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cm= d, const char *optname, if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0) return NULL; =20 + if (!n) + return NULL; + vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n", cmd->def->name, optname, n); =20 --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list