diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2016-04-27 11:05:08 +0100 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2016-05-26 11:31:53 +0530 |
commit | 8925839f00cd2d9fd96066154098db476140b715 (patch) | |
tree | fb948d6a0f8a62c94c8f51af76bfffff60f98d24 /migration/savevm.c | |
parent | 6ddd2d76ca6f86f7a6c29291ec3bca32d15bab24 (diff) |
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 <dgilbert@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1461751518-12128-19-git-send-email-berrange@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'migration/savevm.c')
-rw-r--r-- | migration/savevm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/migration/savevm.c b/migration/savevm.c index 43031a0730..2bd345200a 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) { |