From 8925839f00cd2d9fd96066154098db476140b715 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 27 Apr 2016 11:05:08 +0100 Subject: migration: convert savevm to use QIOChannel for writing to files Convert the exec savevm code to use QIOChannel and QEMUFileChannel, instead of the stdio APIs. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Daniel P. Berrange Message-Id: <1461751518-12128-19-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah --- migration/savevm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'migration') diff --git a/migration/savevm.c b/migration/savevm.c index 43031a0..2bd3452 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -52,6 +52,7 @@ #include "block/qapi.h" #include "qemu/cutils.h" #include "io/channel-buffer.h" +#include "io/channel-file.h" #ifndef ETH_P_RARP #define ETH_P_RARP 0x8035 @@ -2046,6 +2047,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) void qmp_xen_save_devices_state(const char *filename, Error **errp) { QEMUFile *f; + QIOChannelFile *ioc; int saved_vm_running; int ret; @@ -2053,11 +2055,11 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp) vm_stop(RUN_STATE_SAVE_VM); global_state_store_running(); - f = qemu_fopen(filename, "wb"); - if (!f) { - error_setg_file_open(errp, errno, filename); + ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp); + if (!ioc) { goto the_end; } + f = qemu_fopen_channel_output(QIO_CHANNEL(ioc)); ret = qemu_save_device_state(f); qemu_fclose(f); if (ret < 0) { -- cgit v1.1