On Thu, Aug 19, 2010 at 10:36:55AM -0600, Eric Blake wrote: > On 08/19/2010 10:33 AM, Eric Blake wrote: > > On 08/19/2010 08:47 AM, Jiri Denemark wrote: > >> --- > >> src/qemu/qemu_monitor_json.c | 9 ++------- > >> 1 files changed, 2 insertions(+), 7 deletions(-) > >> > >> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c > >> index e8609aa..8a586bc 100644 > >> --- a/src/qemu/qemu_monitor_json.c > >> +++ b/src/qemu/qemu_monitor_json.c > >> @@ -1481,17 +1481,12 @@ int qemuMonitorJSONSetMigrationDowntime(qemuMonitorPtr mon, > >> unsigned long long downtime) > >> { > >> int ret; > >> - char *downtimestr; > >> virJSONValuePtr cmd; > >> virJSONValuePtr reply = NULL; > >> - if (virAsprintf(&downtimestr, "%llums", downtime) < 0) { > >> - virReportOOMError(); > >> - return -1; > >> - } > >> + > >> cmd = qemuMonitorJSONMakeCommand("migrate_set_downtime", > >> - "s:value", downtimestr, > >> + "d:value", downtime / 1000.0, > > > > Does "d:value" correctly handle an unsigned long long argument passed > > through varargs? I'm thinking you either need a modifier in > > qemuMonitorJSONMakeCommand that knows how to receive long long > > arguments, or you need a cast here to pass the correct integer type. > > Never mind. I was thinking too much of printf's %d. But with > qemuMonitorJSONMakeCommand, d: is a double, and your division by 1000.0 > does indeed create a value that passes just fine through varargs. I've never understood why printf() choose %d for integers instead of doubles :-) Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list