Re: [PATCH virt-viewer] Fix recent --spice-controller regression, add error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks good, ack.

One remark though (just a remark as the behavior is
from before this test). Wouldn't it be better to error
out when g_strv_length(args) != 1, rather then showing
the connection dialog as if no args were given?

Regards,

Hans


On 03/29/2012 06:15 PM, Marc-André Lureau wrote:
The current code will attempt to dereference args if
--spice-controller, even if args is NULL.

Let's not accept any extra argument/uri on the command line if using
the controller. Beside, the conditionnal block looks better outside of
the if condition.
---
  src/remote-viewer-main.c |   10 +++++++---
  1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index f60edb6..1289f1c 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -252,11 +252,15 @@ main(int argc, char **argv)

      g_option_context_free(context);

-    if ((!args || (g_strv_length(args) != 1))
  #if HAVE_SPICE_GTK
-&&  !controller
+    if (controller) {
+        if (args) {
+            g_printerr(_("Error: extra arguments given while using Spice controller\n"));
+            goto cleanup;
+        }
+    } else
  #endif
-        ) {
+    if (!args || (g_strv_length(args) != 1)) {
          if (connect_dialog(&uri) != 0)
              goto cleanup;
      } else {


[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux