Patchwork [4/6] vnc.c: warn about ignored option

login
register
mail settings
Submitter Paolo Bonzini
Date Jan. 26, 2010, 11:14 p.m.
Message ID <1264547685-21129-5-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/43755/
State New
Headers show

Comments

Paolo Bonzini - Jan. 26, 2010, 11:14 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 vnc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Anthony Liguori - Jan. 27, 2010, 2:10 a.m.
On 01/26/2010 05:14 PM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   vnc.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/vnc.c b/vnc.c
> index cc2a26e..9ebee09 100644
> --- a/vnc.c
> +++ b/vnc.c
> @@ -2563,6 +2563,7 @@ int vnc_display_open(DisplayState *ds, const char *display)
>               reverse = 1;
>           } else if (strncmp(options, "to=", 3) == 0) {
>               to_port = atoi(options+3) + 5900;
> +            fprintf(stderr, "qemu: warning: to= option for -vnc ignored\n");
>    

If we're ignoring it, why even have the code?  How did clang spot this?

Regards,

Anthony Liguori
Gerd Hoffmann - Jan. 27, 2010, 10 a.m.
On 01/27/10 03:10, Anthony Liguori wrote:
> On 01/26/2010 05:14 PM, Paolo Bonzini wrote:
>> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
>> ---
>> vnc.c | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/vnc.c b/vnc.c
>> index cc2a26e..9ebee09 100644
>> --- a/vnc.c
>> +++ b/vnc.c
>> @@ -2563,6 +2563,7 @@ int vnc_display_open(DisplayState *ds, const
>> char *display)
>> reverse = 1;
>> } else if (strncmp(options, "to=", 3) == 0) {
>> to_port = atoi(options+3) + 5900;
>> + fprintf(stderr, "qemu: warning: to= option for -vnc ignored\n");
>
> If we're ignoring it, why even have the code? How did clang spot this?

to= isn't ignored.  The to= handling has been moved to qemu-socket.c 
though a while ago.  So clang spotted correctly that to_port variable is 
unused.  The whole 'if (...) {}' is a leftover which can go away now.

cheers,
   Gerd

Patch

diff --git a/vnc.c b/vnc.c
index cc2a26e..9ebee09 100644
--- a/vnc.c
+++ b/vnc.c
@@ -2563,6 +2563,7 @@  int vnc_display_open(DisplayState *ds, const char *display)
             reverse = 1;
         } else if (strncmp(options, "to=", 3) == 0) {
             to_port = atoi(options+3) + 5900;
+            fprintf(stderr, "qemu: warning: to= option for -vnc ignored\n");
 #ifdef CONFIG_VNC_SASL
         } else if (strncmp(options, "sasl", 4) == 0) {
             sasl = 1; /* Require SASL auth */