aboutsummaryrefslogtreecommitdiff
path: root/ui/vnc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui/vnc.c')
-rw-r--r--ui/vnc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index fdc4a70d02..0b5aad2952 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2638,16 +2638,19 @@ int vnc_display_disable_login(DisplayState *ds)
int vnc_display_password(DisplayState *ds, const char *password)
{
+ int ret = 0;
VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
if (!vs) {
- return -1;
+ ret = -EINVAL;
+ goto out;
}
if (!password) {
/* This is not the intention of this interface but err on the side
of being safe */
- return vnc_display_disable_login(ds);
+ ret = vnc_display_disable_login(ds);
+ goto out;
}
if (vs->password) {
@@ -2656,8 +2659,11 @@ int vnc_display_password(DisplayState *ds, const char *password)
}
vs->password = qemu_strdup(password);
vs->auth = VNC_AUTH_VNC;
-
- return 0;
+out:
+ if (ret != 0) {
+ qerror_report(QERR_SET_PASSWD_FAILED);
+ }
+ return ret;
}
int vnc_display_pw_expire(DisplayState *ds, time_t expires)