diff mbox series

[RFC,11/15] job-qmp: job_query_single_locked: add assertion on job ret

Message ID 20240313150907.623462-12-vsementsov@yandex-team.ru
State New
Headers show
Series block job API | expand

Commit Message

Vladimir Sementsov-Ogievskiy March 13, 2024, 3:09 p.m. UTC
job->ret must be always set together with job->err. Let's assert this.
Reproting no-error to the user, when job->err is unset and job->ret is
somehow set would be a bug.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 job-qmp.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/job-qmp.c b/job-qmp.c
index 9643c5424d..3e2172c26a 100644
--- a/job-qmp.c
+++ b/job-qmp.c
@@ -163,6 +163,7 @@  static JobInfo *job_query_single_locked(Job *job, Error **errp)
     uint64_t progress_total;
 
     assert(!job_is_internal(job));
+    assert(!job->err == !job->ret);
     progress_get_snapshot(&job->progress, &progress_current,
                           &progress_total);