aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/linux_ioctl.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2011-10-20 18:36:36 (GMT)
committerJouni Malinen <j@w1.fi>2011-10-20 18:36:36 (GMT)
commit6e8183d714d152c67c277dc11faf7a7aeb8b2757 (patch)
treef3df01ea44f1dc8f8eb10eb9ab4064cd06ddacce /src/drivers/linux_ioctl.c
parent8c0d3b4fc668f857af39efdb69f8a6acf580bde1 (diff)
downloadhostap-6e8183d714d152c67c277dc11faf7a7aeb8b2757.zip
hostap-6e8183d714d152c67c277dc11faf7a7aeb8b2757.tar.gz
hostap-6e8183d714d152c67c277dc11faf7a7aeb8b2757.tar.bz2
nl80211: Stop more quickly on initialization errors
Stop on fatal errors like an attempt to use a non-existing interface or not have root privileges to avoid producing confusing error messages.
Diffstat (limited to 'src/drivers/linux_ioctl.c')
-rw-r--r--src/drivers/linux_ioctl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/drivers/linux_ioctl.c b/src/drivers/linux_ioctl.c
index 0d6cf54..3f7ee29 100644
--- a/src/drivers/linux_ioctl.c
+++ b/src/drivers/linux_ioctl.c
@@ -24,6 +24,7 @@
int linux_set_iface_flags(int sock, const char *ifname, int dev_up)
{
struct ifreq ifr;
+ int ret;
if (sock < 0)
return -1;
@@ -32,9 +33,10 @@ int linux_set_iface_flags(int sock, const char *ifname, int dev_up)
os_strlcpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) {
+ ret = errno ? -errno : -999;
wpa_printf(MSG_ERROR, "Could not read interface %s flags: %s",
ifname, strerror(errno));
- return -1;
+ return ret;
}
if (dev_up) {
@@ -48,9 +50,10 @@ int linux_set_iface_flags(int sock, const char *ifname, int dev_up)
}
if (ioctl(sock, SIOCSIFFLAGS, &ifr) != 0) {
+ ret = errno ? -errno : -999;
wpa_printf(MSG_ERROR, "Could not set interface %s flags: %s",
ifname, strerror(errno));
- return -1;
+ return ret;
}
return 0;