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

[libvirt] [PATCH] Don't use %.3d format for bus/addr of USB devices.



When using 0-prefixed numbers, QEmu will interpret them as octal numbers
(as C convention says); this means that if you attach a device that has
addr > 10 (decimal) you're going to attach a different device.
---
 src/qemu/qemu_conf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 00e89a1..5bd3d4c 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -3266,7 +3266,7 @@ qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev)
         return NULL;
     }
 
-    if (virAsprintf(&ret, "usb-host,hostbus=%.3d,hostaddr=%.3d,id=%s",
+    if (virAsprintf(&ret, "usb-host,hostbus=%d,hostaddr=%d,id=%s",
                     dev->source.subsys.u.usb.bus,
                     dev->source.subsys.u.usb.device,
                     dev->info.alias) < 0)
@@ -3288,7 +3288,7 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev)
         return NULL;
     }
 
-    if (virAsprintf(&ret, "host:%.3d.%.3d",
+    if (virAsprintf(&ret, "host:%d.%d",
                     dev->source.subsys.u.usb.bus,
                     dev->source.subsys.u.usb.device) < 0)
         virReportOOMError();
-- 
1.7.3.2


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