]> Git Repo - qemu.git/commitdiff
vnc: Simplify vnc_display_password()
authorLuiz Capitulino <[email protected]>
Wed, 7 Dec 2011 12:19:10 +0000 (10:19 -0200)
committerLuiz Capitulino <[email protected]>
Wed, 18 Jan 2012 12:23:38 +0000 (10:23 -0200)
Drop the qerror_report() call from it and let its callers set the error
themselves. This also allows for dropping the 'ret' variable.

Signed-off-by: Luiz Capitulino <[email protected]>
console.h
monitor.c
ui/vnc.c

index 9466886b59f4dbd2c2189b0f6158fe1176d897d6..be3b7c8b4f5a448052fcd47381c20685fea4c0b4 100644 (file)
--- a/console.h
+++ b/console.h
@@ -384,7 +384,6 @@ int vnc_display_pw_expire(DisplayState *ds, time_t expires);
 #else
 static inline int vnc_display_password(DisplayState *ds, const char *password)
 {
-    qerror_report(QERR_FEATURE_DISABLED, "vnc");
     return -ENODEV;
 }
 static inline int vnc_display_pw_expire(DisplayState *ds, time_t expires)
index 733440115ff9838a9f6c8a3d05bfbcd345f4e52f..759c1335c3d6a867db46f513ad7f289965a3d741 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -929,7 +929,12 @@ static int set_password(Monitor *mon, const QDict *qdict, QObject **ret_data)
         }
         /* Note that setting an empty password will not disable login through
          * this interface. */
-        return vnc_display_password(NULL, password);
+        rc = vnc_display_password(NULL, password);
+        if (rc < 0) {
+            qerror_report(QERR_SET_PASSWD_FAILED);
+            return -1;
+        }
+        return 0;
     }
 
     qerror_report(QERR_INVALID_PARAMETER, "protocol");
index 1869a7adeac05f0512a00fac107751d2c3f625e8..16b79ec423b89c467a714eda3b085455d2ff0c59 100644 (file)
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2686,19 +2686,16 @@ 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) {
-        ret = -EINVAL;
-        goto out;
+        return -EINVAL;
     }
 
     if (!password) {
         /* This is not the intention of this interface but err on the side
            of being safe */
-        ret = vnc_display_disable_login(ds);
-        goto out;
+        return vnc_display_disable_login(ds);
     }
 
     if (vs->password) {
@@ -2707,11 +2704,8 @@ int vnc_display_password(DisplayState *ds, const char *password)
     }
     vs->password = g_strdup(password);
     vs->auth = VNC_AUTH_VNC;
-out:
-    if (ret != 0) {
-        qerror_report(QERR_SET_PASSWD_FAILED);
-    }
-    return ret;
+
+    return 0;
 }
 
 int vnc_display_pw_expire(DisplayState *ds, time_t expires)
This page took 0.033861 seconds and 4 git commands to generate.