Re: [PATCH 2/2] Support virDomainAttachDevice and virDomainDetachDevice for disks in UML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/24/2010 02:20 PM, Matthias Bolte wrote:
+static int umlDomainAttachUmlDisk(struct uml_driver *driver,
+                                  virDomainObjPtr vm,
+                                  virDomainDiskDefPtr disk)
+{
+    int i, ret;
+    char *cmd = NULL;
+    char *reply = NULL;
+
+    for (i = 0 ; i<  vm->def->ndisks ; i++) {
+        if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
+            umlReportError(VIR_ERR_OPERATION_FAILED,
+                           _("target %s already exists"), disk->dst);
+            return -1;
+        }
+    }
+
+    if (!disk->src) {
+        umlReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("disk source path is missing"));
+        goto error;
+    }
+
+    if (virAsprintf(&cmd, "config %s=%s", disk->dst, disk->src)<  0) {
+        virReportOOMError();
+        return -1;
+    }
+
+    if (umlMonitorCommand(driver, vm, cmd,&reply)<  0)
+        goto error;
+
+    if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1)<  0) {
+        virReportOOMError();
+        goto error;
+    }
+
+    if (ret<  0)
+        goto error;

I was about to push this patch, but compile testing gave this error:

uml/uml_driver.c: In function 'umlDomainAttachUmlDisk':
uml/uml_driver.c:1729: error: 'ret' may be used uninitialized in this
function [-Wuninitialized]

I think "if (ret<  0) goto error;" and "int ret;" can just be removed
completely from this function, but I would like have your ACK on this
before doing so.

ACK to that modification - I don't see any real use of ret in this function.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]