]> git.proxmox.com Git - mirror_qemu.git/commit
net/socket: Improve -net socket error reporting
authorMao Zhongyi <maozy.fnst@cn.fujitsu.com>
Mon, 4 Sep 2017 14:35:40 +0000 (22:35 +0800)
committerJason Wang <jasowang@redhat.com>
Fri, 8 Sep 2017 00:17:37 +0000 (08:17 +0800)
commit0522a959aec29768610900636f6234ab40530f82
tree86513fab9d0c58d8806211b89a160819782e62b2
parentbcd4dfd6852361361d6622de7e67f94e2b475d27
net/socket: Improve -net socket error reporting

When -net socket fails, it first reports a specific error, then
a generic one, like this:

    $ ./x86_64-softmmu/qemu-system-x86_64 -net socket,mcast=230.0.0.1:1234,listen
    qemu-system-x86_64: -net socket,mcast=230.0.0.1:1234,listen: exactly one of listen=, connect=, mcast= or udp= is required
    qemu-system-x86_64: -net socket,mcast=230.0.0.1:1234,listen: Device 'socket' could not be initialized

Convert net_socket_*_init() to Error to get rid of the superfluous second
error message. After the patch, the effect like this:

    $ ./x86_64-softmmu/qemu-system-x86_64 -net socket,mcast=230.0.0.1:1234,listen
    qemu-system-x86_64: -net socket,mcast=230.0.0.1:1234,listen: exactly one of listen=, connect=, mcast= or udp= is requireda

This also fixes a few silent failures to report an error.

Cc: jasowang@redhat.com
Cc: armbru@redhat.com
Cc: berrange@redhat.com
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/socket.c