qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 13/15] tap-solaris: Convert tap_open() to Error


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 13/15] tap-solaris: Convert tap_open() to Error
Date: Thu, 14 May 2015 16:00:57 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 05/12/2015 06:03 AM, Markus Armbruster wrote:
> Fixes inappropriate use of syslog().
> 
> Not fixed: leaks on error paths, suspicious non-fatal errors.  FIXMEs
> added instead.

At least you're admitting where the code is still bad.

> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  net/tap-solaris.c | 59 
> ++++++++++++++++++++++++++++---------------------------
>  1 file changed, 30 insertions(+), 29 deletions(-)
> 

> @@ -99,20 +100,20 @@ static int tap_alloc(char *dev, size_t dev_size)
>      strioc_ppa.ic_len = sizeof(ppa);
>      strioc_ppa.ic_dp = (char *)&ppa;
>      if ((ppa = ioctl (tap_fd, I_STR, &strioc_ppa)) < 0)
> -       syslog (LOG_ERR, "Can't assign new interface");
> +        error_report("Can't assign new interface");

I see you're fixing spacing while at it, as well.

>  
>      TFR(if_fd = open("/dev/tap", O_RDWR, 0));
>      if (if_fd < 0) {
> -       syslog(LOG_ERR, "Can't open /dev/tap (2)");
> -       return -1;
> +        error_setg(errp, "Can't open /dev/tap (2)");
> +        return -1;
>      }
>      if(ioctl(if_fd, I_PUSH, "ip") < 0){
> -       syslog(LOG_ERR, "Can't push IP module");

Should you add the space after 'if' while touching this?

> -       return -1;
> +        error_setg(errp, "Can't push IP module");
> +        return -1;
>      }
>  
>      if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0)
> -     syslog(LOG_ERR, "Can't get flags\n");
> +        error_report("Can't get flags");

What about adding missing {} while touching this file?  Hmm - there's
enough cruft that it may involve a separate patch just to clean up
style. For this patch, I'm not going to hold up review on style.

Reviewed-by: Eric Blake <address@hidden>

-- 
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

[Prev in Thread] Current Thread [Next in Thread]