-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc | 18 | ||||
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh | 1 |
2 files changed, 13 insertions, 6 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 @@ -133,2 +133,3 @@ int card_set_promisc_up (const char *device) perror("Could not access the interface, "); + close(fd); return 0; @@ -142,2 +143,3 @@ int card_set_promisc_up (const char *device) perror("Could not access the interface, "); + close(fd); return 0; @@ -147,4 +149,4 @@ int card_set_promisc_up (const char *device) { - printf("%s is ok\n", device); - return 1; + close(fd); + return 1; } @@ -152,4 +154,5 @@ int card_set_promisc_up (const char *device) { - printf("%s flags could not be set", device); - return 0; + wl_logerr("Could not set promisc flag on %d", device); + close(fd); + return 0; } @@ -174,2 +177,3 @@ int card_set_channel (const char *device, int channel, int cardtype) fd = socket(AF_INET, SOCK_STREAM, 0); + if ( fd == -1 ) { @@ -185,3 +189,3 @@ int card_set_channel (const char *device, int channel, int cardtype) /* All was fine... */ - // close(fd); + close(fd); wl_loginfo("Set channel %d on interface %s",channel, device); @@ -190,3 +194,5 @@ int card_set_channel (const char *device, int channel, int cardtype) else - { /* iocall does not work */ + { + /* iocall does not work */ + close(fd); wl_logerr("Could not set channel %d on %s, check cardtype",channel, device); 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 @@ -14,2 +14,3 @@ #include <sys/ioctl.h> +#include <unistd.h> #include <linux/if.h> |