aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-01-09 20:03:18 +0100
committerMarkus Armbruster <armbru@redhat.com>2023-01-19 13:30:01 +0100
commitbcaf1fde57cfcb8952a8778ede0d4cf4136420b6 (patch)
tree0df4fd9c203005f617e7864c858935036b1b1b57 /ui
parentf916a1751e735d3202a2dfc051d324a206831b69 (diff)
downloadqemu-bcaf1fde57cfcb8952a8778ede0d4cf4136420b6.zip
qemu-bcaf1fde57cfcb8952a8778ede0d4cf4136420b6.tar.gz
qemu-bcaf1fde57cfcb8952a8778ede0d4cf4136420b6.tar.bz2
ui: Reduce nesting in hmp_change_vnc() slightly
Transform if (good) { do stuff } else { handle error } to if (!good) { handle error return; } do stuff Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230109190321.1056914-15-armbru@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/ui-hmp-cmds.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c
index 8ae9674..7ca80c8 100644
--- a/ui/ui-hmp-cmds.c
+++ b/ui/ui-hmp-cmds.c
@@ -328,19 +328,16 @@ void hmp_change_vnc(Monitor *mon, const char *device, const char *target,
error_setg(errp, "Parameter 'read-only-mode' is invalid for VNC");
return;
}
- if (strcmp(target, "passwd") == 0 ||
- strcmp(target, "password") == 0) {
- if (!arg) {
- MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
- monitor_read_password(hmp_mon, hmp_change_read_arg, NULL);
- return;
- } else {
- qmp_change_vnc_password(arg, errp);
- }
- } else {
+ if (strcmp(target, "passwd") && strcmp(target, "password")) {
error_setg(errp, "Expected 'password' after 'vnc'");
return;
}
+ if (!arg) {
+ MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
+ monitor_read_password(hmp_mon, hmp_change_read_arg, NULL);
+ } else {
+ qmp_change_vnc_password(arg, errp);
+ }
}
#endif