On 05/12/2015 06:02 AM, Markus Armbruster wrote:
> When -net dump fails, it first reports a specific error, then a
> generic one, like this:
> 
>     $ qemu-system-x86_64 -net dump,id=foo,file=/eperm
>     qemu-system-x86_64: -net dump,id=foo,file=/eperm: -net dump: can't open 
> /eperm
>     qemu-system-x86_64: -net dump,id=foo,file=/eperm: Device 'dump' could not 
> be initialized
> 
> Convert net_init_tap() to Error.  This suppresses the unwanted second
> message.
> 
> Signed-off-by: Markus Armbruster <arm...@redhat.com>
> ---
>  net/dump.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 

> @@ -111,7 +112,7 @@ static int net_dump_init(NetClientState *peer, const char 
> *device,
>  
>      fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);
>      if (fd < 0) {
> -        error_report("-net dump: can't open %s", filename);
> +        error_setg_errno(errp, errno, "-net dump: can't open %s", filename);

It also adds the strerror() text into the output of this message.  Might
be worth mentioning that in the commit message.

Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to