From 8102307f51e68280ac965a140a87073d5c31e9a5 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 27 Jun 2015 16:48:14 +0200 Subject: [PATCH] qapi-commands: Fix gen_err_check(e) for e and e != 'local_err' gen_err_check() hard-codes 'local_err' instead of substituting the argument. Currently harmless, since all callers pass either None or 'local_err'. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- scripts/qapi-commands.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 69029f58fb..3965ca8e9a 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -29,14 +29,15 @@ def generate_command_decl(name, args, ret_type): ret_type=c_type(ret_type), name=c_name(name), args=arglist).strip() -def gen_err_check(errvar): - if errvar: - return mcgen(''' -if (local_err) { +def gen_err_check(err): + if not err: + return '' + return mcgen(''' +if (%(err)s) { goto out; } -''') - return '' +''', + err=err) def gen_sync_call(name, args, ret_type): ret = ""