summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc14
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh1
2 files changed, 11 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
index 9e0a772..29dcc75 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
@@ -131,6 +131,7 @@ int card_set_promisc_up (const char *device)
if (err < 0)
{
perror("Could not access the interface, ");
+ close(fd);
return 0;
}
@@ -140,17 +141,19 @@ int card_set_promisc_up (const char *device)
if (err < 0)
{
perror("Could not access the interface, ");
+ close(fd);
return 0;
}
if(ifr.ifr_flags && IFF_UP)
{
- printf("%s is ok\n", device);
+ close(fd);
return 1;
}
else
{
- printf("%s flags could not be set", device);
+ wl_logerr("Could not set promisc flag on %d", device);
+ close(fd);
return 0;
}
}
@@ -172,6 +175,7 @@ int card_set_channel (const char *device, int channel, int cardtype)
int *ptr;
/* Socket needed to use the iocall to */
fd = socket(AF_INET, SOCK_STREAM, 0);
+
if ( fd == -1 ) {
return -1;
}
@@ -183,12 +187,14 @@ int card_set_channel (const char *device, int channel, int cardtype)
if (ioctl( fd, SIOCIWFIRSTPRIV + 0x8, &ireq)==0)
{
/* All was fine... */
- // close(fd);
+ close(fd);
wl_loginfo("Set channel %d on interface %s",channel, device);
return 1;
}
else
- { /* iocall does not work */
+ {
+ /* iocall does not work */
+ close(fd);
wl_logerr("Could not set channel %d on %s, check cardtype",channel, device);
return 0;
}
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
index 242d8c5..4a95956 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
@@ -12,6 +12,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
+#include <unistd.h>
#include <linux/if.h>
#include <linux/wireless.h>