* [Qemu-devel] [PATCH] migration: Fix seg with missing port
@ 2016-09-12 19:03 Dr. David Alan Gilbert (git)
2016-09-12 19:11 ` Daniel P. Berrange
2016-09-15 14:28 ` Paolo Bonzini
0 siblings, 2 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2016-09-12 19:03 UTC (permalink / raw)
To: qemu-devel, berrange, quintela, amit.shah
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
The command :
migrate tcp:localhost:
currently segs; fix it so it now says:
error parsing address 'localhost:'
and the same for -incoming.
(We know that errp is non-null; callers use a local_err).
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/socket.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/migration/socket.c b/migration/socket.c
index 00de1fe..6e82924 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -113,7 +113,9 @@ void tcp_start_outgoing_migration(MigrationState *s,
Error **errp)
{
SocketAddress *saddr = tcp_build_address(host_port, errp);
- socket_start_outgoing_migration(s, saddr, errp);
+ if (!*errp) {
+ socket_start_outgoing_migration(s, saddr, errp);
+ }
}
void unix_start_outgoing_migration(MigrationState *s,
@@ -175,7 +177,9 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
void tcp_start_incoming_migration(const char *host_port, Error **errp)
{
SocketAddress *saddr = tcp_build_address(host_port, errp);
- socket_start_incoming_migration(saddr, errp);
+ if (!*errp) {
+ socket_start_incoming_migration(saddr, errp);
+ }
}
void unix_start_incoming_migration(const char *path, Error **errp)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [Qemu-devel] [PATCH] migration: Fix seg with missing port
2016-09-12 19:03 [Qemu-devel] [PATCH] migration: Fix seg with missing port Dr. David Alan Gilbert (git)
@ 2016-09-12 19:11 ` Daniel P. Berrange
2016-09-12 19:23 ` Eric Blake
2016-09-15 14:28 ` Paolo Bonzini
1 sibling, 1 reply; 4+ messages in thread
From: Daniel P. Berrange @ 2016-09-12 19:11 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, quintela, amit.shah
On Mon, Sep 12, 2016 at 08:03:54PM +0100, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> The command :
> migrate tcp:localhost:
>
> currently segs; fix it so it now says:
>
> error parsing address 'localhost:'
>
> and the same for -incoming.
>
> (We know that errp is non-null; callers use a local_err).
I'd still be more comfortable with us using a local Error
object here, as it illustrates best practice and protects
against future accidents.
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> migration/socket.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/migration/socket.c b/migration/socket.c
> index 00de1fe..6e82924 100644
> --- a/migration/socket.c
> +++ b/migration/socket.c
> @@ -113,7 +113,9 @@ void tcp_start_outgoing_migration(MigrationState *s,
> Error **errp)
> {
> SocketAddress *saddr = tcp_build_address(host_port, errp);
> - socket_start_outgoing_migration(s, saddr, errp);
> + if (!*errp) {
> + socket_start_outgoing_migration(s, saddr, errp);
> + }
> }
>
> void unix_start_outgoing_migration(MigrationState *s,
> @@ -175,7 +177,9 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
> void tcp_start_incoming_migration(const char *host_port, Error **errp)
> {
> SocketAddress *saddr = tcp_build_address(host_port, errp);
> - socket_start_incoming_migration(saddr, errp);
> + if (!*errp) {
> + socket_start_incoming_migration(saddr, errp);
> + }
> }
Yep, makes sense
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Qemu-devel] [PATCH] migration: Fix seg with missing port
2016-09-12 19:11 ` Daniel P. Berrange
@ 2016-09-12 19:23 ` Eric Blake
0 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2016-09-12 19:23 UTC (permalink / raw)
To: Daniel P. Berrange, Dr. David Alan Gilbert (git)
Cc: amit.shah, qemu-devel, quintela
[-- Attachment #1: Type: text/plain, Size: 1558 bytes --]
On 09/12/2016 02:11 PM, Daniel P. Berrange wrote:
> On Mon, Sep 12, 2016 at 08:03:54PM +0100, Dr. David Alan Gilbert (git) wrote:
>> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>>
>> The command :
>> migrate tcp:localhost:
>>
>> currently segs; fix it so it now says:
>>
>> error parsing address 'localhost:'
>>
>> and the same for -incoming.
>>
>> (We know that errp is non-null; callers use a local_err).
>
> I'd still be more comfortable with us using a local Error
> object here, as it illustrates best practice and protects
> against future accidents.
Concur. Having an example contrary to best practice makes it far too
easy for that example to be copied somewhere where it will later break.
>> +++ b/migration/socket.c
>> @@ -113,7 +113,9 @@ void tcp_start_outgoing_migration(MigrationState *s,
>> Error **errp)
>> {
>> SocketAddress *saddr = tcp_build_address(host_port, errp);
>> - socket_start_outgoing_migration(s, saddr, errp);
>> + if (!*errp) {
>> + socket_start_outgoing_migration(s, saddr, errp);
>> + }
Since we make a decision about code flow based on whether an earlier
error occurred, this SHOULD be:
{
Error *err = NULL;
SocketAddress *saddr = tcp_build_address(host_port, &err);
if (!err) {
socket_start_outgoing_migration(s, saddr, &err);
}
error_propagate(errp, err);
}
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: Fix seg with missing port
2016-09-12 19:03 [Qemu-devel] [PATCH] migration: Fix seg with missing port Dr. David Alan Gilbert (git)
2016-09-12 19:11 ` Daniel P. Berrange
@ 2016-09-15 14:28 ` Paolo Bonzini
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2016-09-15 14:28 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git), qemu-devel, berrange, quintela,
amit.shah
On 12/09/2016 21:03, Dr. David Alan Gilbert (git) wrote:
> SocketAddress *saddr = tcp_build_address(host_port, errp);
> - socket_start_outgoing_migration(s, saddr, errp);
> + if (!*errp) {
> + socket_start_outgoing_migration(s, saddr, errp);
> + }
> }
>
> void unix_start_outgoing_migration(MigrationState *s,
> @@ -175,7 +177,9 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
> void tcp_start_incoming_migration(const char *host_port, Error **errp)
> {
> SocketAddress *saddr = tcp_build_address(host_port, errp);
> - socket_start_incoming_migration(saddr, errp);
> + if (!*errp) {
> + socket_start_incoming_migration(saddr, errp);
> + }
FWIW, this less-boilerplate version was almost fine, just replace
"!*errp" with "saddr".
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-15 14:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-12 19:03 [Qemu-devel] [PATCH] migration: Fix seg with missing port Dr. David Alan Gilbert (git)
2016-09-12 19:11 ` Daniel P. Berrange
2016-09-12 19:23 ` Eric Blake
2016-09-15 14:28 ` Paolo Bonzini
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).