tools/xl: Fix exit code for xl vkbattach

Various version of gcc, when compiling with -Og, complain:

  xl_vkb.c: In function 'main_vkbattach':
  xl_vkb.c:79:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     79 |     return rc;
        |            ^~

The dryrun_only path really does leave rc uninitalised.  Introduce a done
label for success paths to use.

Fixes: a15166af7c ("xl: add vkb config parser and CLI")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Ian Jackson <iwj@xenproject.org>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
This commit is contained in:
Andrew Cooper committed 2021-02-17 12:37:08 +00:00
1 parent d670ef3401
commit 8e5b2029fe
1 file changed
+2 -1
+2 -1
View File
@@ -64,7 +64,7 @@ int main_vkbattach(int argc, char **argv)
char *json = libxl_device_vkb_to_json(ctx, &vkb);
printf("vkb: %s\n", json);
free(json);
goto out;
goto done;
}
if (libxl_device_vkb_add(ctx, domid, &vkb, 0)) {
@@ -72,6 +72,7 @@ int main_vkbattach(int argc, char **argv)
rc = ERROR_FAIL; goto out;
}
done:
rc = 0;
out:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.