]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: check the return value of virStoragePoolGetAutostart
authorJán Tomko <jtomko@redhat.com>
Fri, 30 Nov 2012 12:09:21 +0000 (13:09 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 30 Nov 2012 14:35:14 +0000 (15:35 +0100)
On error, virStoragePoolGetAutostart would return -1 leaving autostart
untouched.

Removed the misleading debug message as well.

Error: CHECKED_RETURN (CWE-252):
libvirt-0.10.2/tools/virsh-pool.c:1386: unchecked_value: No check of the
    return value of "virStoragePoolGetAutostart(pool, &autostart)".

tools/virsh-pool.c

index c08cce654a0f18d3d6ae2e2d046a018301520c89..5fee2cdedfd8747f64b169c4e7d714d21cde7a98 100644 (file)
@@ -1383,10 +1383,7 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd)
             vshPrint(ctl, "%-15s %s\n", _("Persistent:"), persistent ? _("yes") : _("no"));
 
         /* Check and display whether the pool is autostarted or not */
-        virStoragePoolGetAutostart(pool, &autostart);
-        vshDebug(ctl, VSH_ERR_DEBUG, "Pool autostart flag value: %d\n",
-                 autostart);
-        if (autostart < 0)
+        if (virStoragePoolGetAutostart(pool, &autostart) < 0)
             vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart"));
         else
             vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") : _("no"));