[libvirt] [PATCH] tools: vsh: Don't use assert()

Peter Krempa posted 1 patch 9 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/4caa83d820f9a7b2d517b2367a0c7181c64cf5f3.1552393121.git.pkrempa@redhat.com
tools/vsh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

[libvirt] [PATCH] tools: vsh: Don't use assert()

Posted by Peter Krempa 9 weeks ago
It's meant for testing, not for production builds. Also we have a helper
for reporting OOM errors. Introduced by 23e0bf1c4eb6

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 tools/vsh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/vsh.c b/tools/vsh.c
index 5e483a5d26..5903f129c1 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -385,7 +385,7 @@ vshCmddefCheckInternals(vshControl *ctl,
             }
             if ((p = strchr(name, '=')) &&
                 VIR_STRNDUP(name, name, p - name) < 0)
-                assert(false); /* Allocation failure during self-test is bad */
+                vshErrorOOM();
             for (j = i + 1; cmd->opts[j].name; j++) {
                 if (STREQ(name, cmd->opts[j].name) &&
                     cmd->opts[j].type != VSH_OT_ALIAS)
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tools: vsh: Don't use assert()

Posted by Peter Krempa 9 weeks ago
On Tue, Mar 12, 2019 at 13:18:41 +0100, Peter Krempa wrote:
> It's meant for testing, not for production builds. Also we have a helper
> for reporting OOM errors. Introduced by 23e0bf1c4eb6
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  tools/vsh.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I'll push this under the trivial rule.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tools: vsh: Don't use assert()

Posted by Eric Blake 9 weeks ago
On 3/12/19 8:25 AM, Peter Krempa wrote:
> On Tue, Mar 12, 2019 at 13:18:41 +0100, Peter Krempa wrote:
>> It's meant for testing, not for production builds. Also we have a helper
>> for reporting OOM errors. Introduced by 23e0bf1c4eb6
>>
>> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>> ---
>>  tools/vsh.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> I'll push this under the trivial rule.

Thanks; that is indeed nicer.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list