]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Don't allow NULL paths for BlockStats and InterfaceStats
authorCole Robinson <crobinso@redhat.com>
Fri, 24 Jul 2009 15:05:28 +0000 (11:05 -0400)
committerCole Robinson <crobinso@redhat.com>
Sun, 26 Jul 2009 21:25:20 +0000 (17:25 -0400)
Do the check in libvirt.c, to save drivers from the burden. This changes
behavior slightly in the qemu driver: we no longer explictly error if
passed an empty string. An error will still be thrown when the device
lookup fails.

src/libvirt.c
src/qemu_driver.c

index 1752e9d93946cb6d75edf92b891354f7e57c269c..61a9b7c62ad6ecca8efa1de09282ef1b10e8e541 100644 (file)
@@ -3599,7 +3599,7 @@ virDomainBlockStats (virDomainPtr dom, const char *path,
         virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return -1;
     }
-    if (!stats || size > sizeof stats2) {
+    if (!path || !stats || size > sizeof stats2) {
         virLibDomainError (dom, VIR_ERR_INVALID_ARG, __FUNCTION__);
         goto error;
     }
@@ -3657,7 +3657,7 @@ virDomainInterfaceStats (virDomainPtr dom, const char *path,
         virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return -1;
     }
-    if (!stats || size > sizeof stats2) {
+    if (!path || !stats || size > sizeof stats2) {
         virLibDomainError (dom, VIR_ERR_INVALID_ARG, __FUNCTION__);
         goto error;
     }
index ac0b80fb2f969424c80308f87218d10b2e053c2d..c594495cfa70a17feffd339cac2eafb361cd8e61 100644 (file)
@@ -5704,12 +5704,6 @@ qemudDomainInterfaceStats (virDomainPtr dom,
         goto cleanup;
     }
 
-    if (!path || path[0] == '\0') {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                         "%s", _("NULL or empty path"));
-        goto cleanup;
-    }
-
     /* Check the path is one of the domain's network interfaces. */
     for (i = 0 ; i < vm->def->nnets ; i++) {
         if (vm->def->nets[i]->ifname &&