> Date: Fri, 2 Dec 2011 00:45:54 -0200
> From: "Christiano F. Haesbaert" <[email protected]>
>
> Hi, I think we should warn() on any error, not just EPERM.
> This is more consistent with the rest of the code.
>
> ok ?
I think the current code is just fine. The "no premission to scan"
output is an integral part of the ifconfig output. If you don't have
the right permission, you just don't get to see the information, much
like that you don't get to see the WEP/WPA keys.
Both your and Thomas' change make the output look ugly, and print to
stderr in the middle of stuff printed to stdout. That always annoys
me.
> Index: ifconfig.c
> ===================================================================
> RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
> retrieving revision 1.252
> diff -d -u -p -b -r1.252 ifconfig.c
> --- ifconfig.c 26 Nov 2011 23:38:18 -0000 1.252
> +++ ifconfig.c 2 Dec 2011 02:32:48 -0000
> @@ -2168,8 +2168,7 @@ ieee80211_listnodes(void)
> strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
>
> if (ioctl(s, SIOCS80211SCAN, (caddr_t)&ifr) != 0) {
> - if (errno == EPERM)
> - printf("\t\tno permission to scan\n");
> + warn("SIOCS80211SCAN");
> goto done;
> }