@@ -802,9 +802,8 @@ int main(int argc, char **argv)
ctx = aio_context_new(&local_error);
if (!ctx) {
- error_report("Failed to create AIO Context: '%s'",
- error_get_pretty(local_error));
- error_free(local_error);
+ error_prefix(local_err, "Failed to create AIO Context: ");
+ error_report_err(local_err);
exit(1);
}
src = aio_get_g_source(ctx);
@@ -229,9 +229,8 @@ int main(int argc, char **argv)
ctx = aio_context_new(&local_error);
if (!ctx) {
- error_report("Failed to create AIO Context: '%s'",
- error_get_pretty(local_error));
- error_free(local_error);
+ error_prefix(local_error, "Failed to create AIO Context:");
+ error_report_err(local_error);
exit(1);
}
pool = aio_get_thread_pool(ctx);
@@ -587,12 +587,11 @@ int main(int argc, char **argv)
ctx = qemu_get_aio_context();
if (!ctx) {
- error_report("Failed to create AIO Context: '%s'",
- local_error ? error_get_pretty(local_error) :
- "Failed to initialize the QEMU main loop");
- if (local_error) {
- error_free(local_error);
+ if (!local_error) {
+ error_setg(&local_error, "Failed to initialize the QEMU main loop");
}
+ error_prefix(local_error, "Failed to create AIO Context: ");
+ error_report_err(local_error);
exit(1);
}
Use error_prefix() and error_report_err() as appropriate. Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> --- tests/test-aio.c | 5 ++--- tests/test-thread-pool.c | 5 ++--- tests/test-throttle.c | 9 ++++----- 3 files changed, 8 insertions(+), 11 deletions(-)