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 {