All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial@nongnu.org, aliguori@us.ibm.com,
	qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-trivial] [Qemu-devel] [RESEND PATCH 1/3] socket: remove	redundant check
Date: Thu, 2 Aug 2012 22:59:29 -0400 (EDT)	[thread overview]
Message-ID: <1248253671.7451894.1343962769761.JavaMail.root@redhat.com> (raw)
In-Reply-To: <876292g7dr.fsf@blackfin.pond.sub.org>

----- Original Message -----
> Stefan Hajnoczi <stefanha@gmail.com> writes:
> 
> > On Wed, Aug 01, 2012 at 04:59:01PM +0800, Amos Kong wrote:
> >> It's aleady in the end of loop, error should be set.
> >> 
> >> Signed-off-by: Amos Kong <akong@redhat.com>
> >> ---
> >>  qemu-sockets.c |    4 +---
> >>  1 files changed, 1 insertions(+), 3 deletions(-)
> >> 
> >> diff --git a/qemu-sockets.c b/qemu-sockets.c
> >> index 668fa93..c636882 100644
> >> --- a/qemu-sockets.c
> >> +++ b/qemu-sockets.c
> >> @@ -181,9 +181,7 @@ int inet_listen_opts(QemuOpts *opts, int
> >> port_offset, Error **errp)
> >>                  fprintf(stderr,"%s: bind(%s,%s,%d): %s\n",
> >>                  __FUNCTION__,
> >>                          inet_strfamily(e->ai_family), uaddr,
> >>                          inet_getport(e),
> >>                          strerror(errno));
> >> -                if (!e->ai_next) {
> >> -                    error_set(errp, QERR_SOCKET_BIND_FAILED);
> >> -                }
> >> +                error_set(errp, QERR_SOCKET_BIND_FAILED);
> >>              }
> >>          }
> >>          closesocket(slisten);
> >
> > This isn't obvious.  It looks like the intent of the if
> > (!e->ai_next) is
> > to suppress the error so that the next iteration of the *outer*
> > loop can
> > succeed.
> >
> > Why is it okay to set QERR_SOCKET_BIND_FAILED?  We may have more
> > addrinfos left to try in the outer loop.  They may succeed so we
> > don't
> > want an error in that case.
> 
> You are correct, and the patch is wrong.


Yeah, will drop this patch from this thread.
Thanks.

> See also related
> http://lists.nongnu.org/archive/html/qemu-devel/2012-02/msg00772.html
> 
> 


WARNING: multiple messages have this Message-ID (diff)
From: Amos Kong <akong@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi <stefanha@gmail.com>,
	aliguori@us.ibm.com, qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [Qemu-trivial] [RESEND PATCH 1/3] socket: remove	redundant check
Date: Thu, 2 Aug 2012 22:59:29 -0400 (EDT)	[thread overview]
Message-ID: <1248253671.7451894.1343962769761.JavaMail.root@redhat.com> (raw)
In-Reply-To: <876292g7dr.fsf@blackfin.pond.sub.org>

----- Original Message -----
> Stefan Hajnoczi <stefanha@gmail.com> writes:
> 
> > On Wed, Aug 01, 2012 at 04:59:01PM +0800, Amos Kong wrote:
> >> It's aleady in the end of loop, error should be set.
> >> 
> >> Signed-off-by: Amos Kong <akong@redhat.com>
> >> ---
> >>  qemu-sockets.c |    4 +---
> >>  1 files changed, 1 insertions(+), 3 deletions(-)
> >> 
> >> diff --git a/qemu-sockets.c b/qemu-sockets.c
> >> index 668fa93..c636882 100644
> >> --- a/qemu-sockets.c
> >> +++ b/qemu-sockets.c
> >> @@ -181,9 +181,7 @@ int inet_listen_opts(QemuOpts *opts, int
> >> port_offset, Error **errp)
> >>                  fprintf(stderr,"%s: bind(%s,%s,%d): %s\n",
> >>                  __FUNCTION__,
> >>                          inet_strfamily(e->ai_family), uaddr,
> >>                          inet_getport(e),
> >>                          strerror(errno));
> >> -                if (!e->ai_next) {
> >> -                    error_set(errp, QERR_SOCKET_BIND_FAILED);
> >> -                }
> >> +                error_set(errp, QERR_SOCKET_BIND_FAILED);
> >>              }
> >>          }
> >>          closesocket(slisten);
> >
> > This isn't obvious.  It looks like the intent of the if
> > (!e->ai_next) is
> > to suppress the error so that the next iteration of the *outer*
> > loop can
> > succeed.
> >
> > Why is it okay to set QERR_SOCKET_BIND_FAILED?  We may have more
> > addrinfos left to try in the outer loop.  They may succeed so we
> > don't
> > want an error in that case.
> 
> You are correct, and the patch is wrong.


Yeah, will drop this patch from this thread.
Thanks.

> See also related
> http://lists.nongnu.org/archive/html/qemu-devel/2012-02/msg00772.html
> 
> 

  reply	other threads:[~2012-08-03  2:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17 15:45 [Qemu-devel] [PATCH 0/2] trivial fix of qemu-sockets.c Amos Kong
2012-07-17 15:45 ` [Qemu-devel] [PATCH 1/2] socket: remove redundant check Amos Kong
2012-07-17 15:45 ` [Qemu-devel] [PATCH 2/2] remove unused include of error.h Amos Kong
2012-08-01  8:59 ` [Qemu-trivial] [RESEND PATCH 0/3] trivial fix of qemu-sockets.c Amos Kong
2012-08-01  8:59   ` [Qemu-devel] " Amos Kong
2012-08-01  8:59 ` [Qemu-trivial] [RESEND PATCH 1/3] socket: remove redundant check Amos Kong
2012-08-01  8:59   ` [Qemu-devel] " Amos Kong
2012-08-01 10:50   ` [Qemu-trivial] " Stefan Hajnoczi
2012-08-01 10:50     ` [Qemu-devel] " Stefan Hajnoczi
2012-08-01 11:23     ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
2012-08-01 11:23       ` [Qemu-devel] [Qemu-trivial] " Peter Maydell
2012-08-01 11:50       ` [Qemu-trivial] [Qemu-devel] " Markus Armbruster
2012-08-01 11:50         ` [Qemu-devel] [Qemu-trivial] " Markus Armbruster
2012-08-01 11:48     ` [Qemu-trivial] [Qemu-devel] " Markus Armbruster
2012-08-01 11:48       ` [Qemu-devel] [Qemu-trivial] " Markus Armbruster
2012-08-03  2:59       ` Amos Kong [this message]
2012-08-03  2:59         ` Amos Kong
2012-08-01  8:59 ` [Qemu-trivial] [RESEND PATCH 2/3] remove unused include of error.h Amos Kong
2012-08-01  8:59   ` [Qemu-devel] " Amos Kong
2012-08-01  8:59 ` [Qemu-trivial] [RESEND PATCH 3/3] socket: clean up redundant assignment Amos Kong
2012-08-01  8:59   ` [Qemu-devel] " Amos Kong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1248253671.7451894.1343962769761.JavaMail.root@redhat.com \
    --to=akong@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.