Re: [PATCHv2 1/3] bnep: Add error print and return errno instead of -1

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

 



Hi Andrei,

On Wed, Oct 22, 2014 at 4:34 PM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@xxxxxxxxx> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>
>
> ---
>  profiles/network/bnep.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
> index 927367c..f8fcd1f 100644
> --- a/profiles/network/bnep.c
> +++ b/profiles/network/bnep.c
> @@ -219,7 +219,7 @@ static int bnep_if_up(const char *devname)
>  static int bnep_if_down(const char *devname)
>  {
>         struct ifreq ifr;
> -       int sk, err;
> +       int sk, err = 0;
>
>         sk = socket(AF_INET, SOCK_DGRAM, 0);
>
> @@ -229,16 +229,15 @@ static int bnep_if_down(const char *devname)
>         ifr.ifr_flags &= ~IFF_UP;
>
>         /* Bring down the interface */
> -       err = ioctl(sk, SIOCSIFFLAGS, (void *) &ifr);
> +       if (ioctl(sk, SIOCSIFFLAGS, (void *) &ifr) < 0) {
> +               err = -errno;
> +               error("bnep: Could not bring down %s: %s(%d)",
> +                                               devname, strerror(-err), -err);
> +       }
>
>         close(sk);
>
> -       if (err < 0) {
> -               error("bnep: Could not bring down %s", devname);
> -               return err;
> -       }
> -
> -       return 0;
> +       return err;
>  }
>
>  static gboolean bnep_watchdog_cb(GIOChannel *chan, GIOCondition cond,
> --
> 1.9.1

Applied, thanks.

-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux