diff options
Diffstat (limited to 'blockjob.c')
-rw-r--r-- | blockjob.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/blockjob.c b/blockjob.c index 9e0ffd8dc9..207e8c7fd9 100644 --- a/blockjob.c +++ b/blockjob.c @@ -320,8 +320,12 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp) info->status = job->job.status; info->auto_finalize = job->job.auto_finalize; info->auto_dismiss = job->job.auto_dismiss; - info->has_error = job->job.ret != 0; - info->error = job->job.ret ? g_strdup(strerror(-job->job.ret)) : NULL; + if (job->job.ret) { + info->has_error = true; + info->error = job->job.err ? + g_strdup(error_get_pretty(job->job.err)) : + g_strdup(strerror(-job->job.ret)); + } return info; } @@ -358,7 +362,7 @@ static void block_job_event_completed(Notifier *n, void *opaque) } if (job->job.ret < 0) { - msg = strerror(-job->job.ret); + msg = error_get_pretty(job->job.err); } qapi_event_send_block_job_completed(job_type(&job->job), |