
On Thu, 2009-09-24 at 16:00 +0100, Daniel P. Berrange wrote:
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new qemuMonitorCloseFileHandle and qemuMonitorSendFileHandle APIs for processing file handles * src/qemu/qemu_driver.c: Convert NIC hotplug method over to use qemuMonitorCloseFileHandle and qemuMonitorSendFileHandle --- src/qemu/qemu_driver.c | 40 +++------------------ src/qemu/qemu_monitor_text.c | 78 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_text.h | 6 +++ 3 files changed, 90 insertions(+), 34 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b447a87..f8710a6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4619,7 +4619,7 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn, { virDomainNetDefPtr net = dev->data.net; char *cmd = NULL, *reply = NULL, *remove_cmd = NULL; - char *tapfd_name = NULL, *tapfd_close = NULL; + char *tapfd_name = NULL; int i, tapfd = -1; unsigned domain, bus, slot;
@@ -4662,32 +4662,8 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn, if (virAsprintf(&tapfd_name, "fd-%s", net->hostnet_name) < 0) goto no_memory;
- if (virAsprintf(&tapfd_close, "closefd %s", tapfd_name) < 0) - goto no_memory;
You're dropping the pre-allocation of the closefd command meaning the code is less likely to actually work under OOM, but we're fantasising if we think our OOM handling is that good anyway :-) ACK Cheers, Mark.