From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org, samuel.thibault@ens-lyon.org,
jan.kiszka@siemens.com
Subject: Re: [Qemu-devel] [PATCH] slirp: Add explanation for hostfwd parsing failure
Date: Fri, 8 Sep 2017 19:36:44 +0100 [thread overview]
Message-ID: <20170908183643.GI2836@work-vm> (raw)
In-Reply-To: <7c4ca224-2577-0ef6-6e19-9760dd58c723@amsat.org>
* Philippe Mathieu-Daudé (f4bug@amsat.org) wrote:
> On 09/08/2017 01:22 PM, Dr. David Alan Gilbert wrote:
> > * Philippe Mathieu-Daudé (f4bug@amsat.org) wrote:
> > > Hi David,
> > >
> > > On 09/08/2017 12:53 PM, Dr. David Alan Gilbert (git) wrote:
> > > > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > > >
> > > > e.g.
> > > > ./x86_64-softmmu/qemu-system-x86_64 -nographic -netdev 'user,id=vnet,hostfwd=:555.0.0.0:0-:22'
> > > > qemu-system-x86_64: -netdev user,id=vnet,hostfwd=:555.0.0.0:0-:22: Invalid host forwarding rule ':555.0.0.0:0-:22' (Bad host address)
> > > >
> > > > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > > > ---
> > > > net/slirp.c | 13 ++++++++++++-
> > > > 1 file changed, 12 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/net/slirp.c b/net/slirp.c
> > > > index 01ed21c006..d87664d42e 100644
> > > > --- a/net/slirp.c
> > > > +++ b/net/slirp.c
> > > > @@ -496,9 +496,11 @@ static int slirp_hostfwd(SlirpState *s, const char *redir_str,
> > > > char buf[256];
> > > > int is_udp;
> > > > char *end;
> > > > + const char *fail_reason = "";
> > >
> > > Isn't it better not initialize this? So if one add a new failed syntax case
> > > the build with abort with -Werror=uninitialized
> >
> > I never quite trust compilers to spot it or not-moan even though
> > every route to failure will have set it.
>
> I see, what about:
>
> const char *fail_reason = "Unknown reason";
I could, but you're right that I shouldn't miss any, and
'Unknown Reason' doesn't tell the user any more than no message.
Dave
> >
> > > Anyway:
> > > Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-09-08 18:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 15:53 [Qemu-devel] [PATCH] slirp: Add explanation for hostfwd parsing failure Dr. David Alan Gilbert (git)
2017-09-08 16:19 ` Philippe Mathieu-Daudé
2017-09-08 16:22 ` Dr. David Alan Gilbert
2017-09-08 18:02 ` Philippe Mathieu-Daudé
2017-09-08 18:36 ` Dr. David Alan Gilbert [this message]
2017-09-08 18:57 ` Philippe Mathieu-Daudé
2017-09-09 20:09 ` Samuel Thibault
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=20170908183643.GI2836@work-vm \
--to=dgilbert@redhat.com \
--cc=f4bug@amsat.org \
--cc=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
--cc=samuel.thibault@ens-lyon.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).