Skip to content
  • Mao Zhongyi's avatar
    0522a959
    net/socket: Improve -net socket error reporting · 0522a959
    Mao Zhongyi authored
    
    
    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: default avatarMao Zhongyi <maozy.fnst@cn.fujitsu.com>
    Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
    0522a959
    net/socket: Improve -net socket error reporting
    Mao Zhongyi authored
    
    
    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: default avatarMao Zhongyi <maozy.fnst@cn.fujitsu.com>
    Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Loading