Diffstat (limited to 'noncore/net/networksetup/wlan/wextensions.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/networksetup/wlan/wextensions.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/net/networksetup/wlan/wextensions.cpp b/noncore/net/networksetup/wlan/wextensions.cpp index e545bd1..eb6fc42 100644 --- a/noncore/net/networksetup/wlan/wextensions.cpp +++ b/noncore/net/networksetup/wlan/wextensions.cpp | |||
@@ -11,37 +11,37 @@ | |||
11 | 11 | ||
12 | #define PROCNETWIRELESS "/proc/net/wireless" | 12 | #define PROCNETWIRELESS "/proc/net/wireless" |
13 | #define IW_LOWER 0 | 13 | #define IW_LOWER 0 |
14 | #define IW_UPPER 256 | 14 | #define IW_UPPER 256 |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Constructor. Sets hasWirelessExtensions | 17 | * Constructor. Sets hasWirelessExtensions |
18 | */ | 18 | */ |
19 | WExtensions::WExtensions(QString interfaceName){ | 19 | WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false){ |
20 | interface = interfaceName; | 20 | interface = interfaceName; |
21 | fd = socket( AF_INET, SOCK_DGRAM, 0 ); | 21 | fd = socket( AF_INET, SOCK_DGRAM, 0 ); |
22 | if(fd == -1) | ||
23 | return; | ||
22 | 24 | ||
23 | const char* buffer[200]; | 25 | const char* buffer[200]; |
24 | memset( &iwr, 0, sizeof( iwr ) ); | 26 | memset( &iwr, 0, sizeof( iwr ) ); |
25 | iwr.u.essid.pointer = (caddr_t) buffer; | 27 | iwr.u.essid.pointer = (caddr_t) buffer; |
26 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 28 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
27 | iwr.u.essid.flags = 0; | 29 | iwr.u.essid.flags = 0; |
28 | 30 | ||
29 | // check if it is an IEEE 802.11 standard conform | 31 | // check if it is an IEEE 802.11 standard conform |
30 | // wireless device by sending SIOCGIWESSID | 32 | // wireless device by sending SIOCGIWESSID |
31 | // which also gives back the Extended Service Set ID | 33 | // which also gives back the Extended Service Set ID |
32 | // (see IEEE 802.11 for more information) | 34 | // (see IEEE 802.11 for more information) |
33 | 35 | ||
34 | const char* iname = interface.latin1(); | 36 | const char* iname = interface.latin1(); |
35 | strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); | 37 | strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); |
36 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) | 38 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) |
37 | hasWirelessExtensions = true; | 39 | hasWirelessExtensions = true; |
38 | else | ||
39 | hasWirelessExtensions = false; | ||
40 | } | 40 | } |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * @return QString the station name of the access point. | 43 | * @return QString the station name of the access point. |
44 | */ | 44 | */ |
45 | QString WExtensions::station(){ | 45 | QString WExtensions::station(){ |
46 | if(!hasWirelessExtensions) | 46 | if(!hasWirelessExtensions) |
47 | return QString(); | 47 | return QString(); |