9cf207b
diff -up wlassistant-0.5.7/src/watools.cpp.BAD wlassistant-0.5.7/src/watools.cpp
9cf207b
--- wlassistant-0.5.7/src/watools.cpp.BAD	2007-07-23 10:13:15.000000000 -0500
9cf207b
+++ wlassistant-0.5.7/src/watools.cpp	2007-07-23 10:16:48.000000000 -0500
9cf207b
@@ -23,6 +23,7 @@
9cf207b
 #include <unistd.h> //provides readlink
9cf207b
 #include <dirent.h>
9cf207b
 #include <stdio.h> //to get values from /sys
9cf207b
+#include <fcntl.h>
9cf207b
 #include <sys/types.h>
9cf207b
 #include <sys/socket.h>
9cf207b
 #include <arpa/inet.h> //inet_ntoa
9cf207b
@@ -178,6 +179,13 @@ int WATools::availableNetworks( const ch
9cf207b
                 _ifname = ifname;
9cf207b
         if (iw_socket<0)
9cf207b
                 iw_socket = iw_sockets_open(); //get kernel socket
9cf207b
+        int flags;
9cf207b
+        flags = fcntl(iw_socket, F_GETFD);
9cf207b
+        if (flags == -1)
9cf207b
+                return 0;
9cf207b
+        flags |= FD_CLOEXEC;
9cf207b
+        if (fcntl(iw_socket, F_SETFD, flags) == -1)
9cf207b
+                return 0;
9cf207b
         if (iw_socket<0)
9cf207b
                 return 0;
9cf207b
 
9cf207b
@@ -264,6 +272,13 @@ int WATools::doRequest( int request, str
9cf207b
                 _ifname = ifname;
9cf207b
         if (iw_socket<0)
9cf207b
                 iw_socket = iw_sockets_open(); //get kernel socket
9cf207b
+        int flags;
9cf207b
+        flags = fcntl(iw_socket, F_GETFD);
9cf207b
+        if (flags == -1)
9cf207b
+                return 0;
9cf207b
+        flags |= FD_CLOEXEC;
9cf207b
+        if (fcntl(iw_socket, F_SETFD, flags) == -1)
9cf207b
+                return 0;
9cf207b
         if (iw_socket<0)
9cf207b
                 return 0;
9cf207b
 
9cf207b
@@ -278,6 +293,13 @@ int WATools::doWirelessRequest( int requ
9cf207b
                 _ifname = ifname;
9cf207b
         if (iw_socket<0)
9cf207b
                 iw_socket = iw_sockets_open(); //get kernel socket
9cf207b
+        int flags;
9cf207b
+        flags = fcntl(iw_socket, F_GETFD);
9cf207b
+        if (flags == -1)
9cf207b
+                return 0;
9cf207b
+        flags |= FD_CLOEXEC;
9cf207b
+        if (fcntl(iw_socket, F_SETFD, flags) == -1)
9cf207b
+                return 0;
9cf207b
         if (iw_socket<0)
9cf207b
                 return 0;
9cf207b
 
9cf207b
@@ -292,6 +314,13 @@ int WATools::doWirelessStatisticsRequest
9cf207b
                 _ifname = ifname;
9cf207b
         if (iw_socket<0)
9cf207b
                 iw_socket = iw_sockets_open();//get kernel socket
9cf207b
+        int flags;
9cf207b
+        flags = fcntl(iw_socket, F_GETFD);
9cf207b
+        if (flags == -1)
9cf207b
+                return 0;
9cf207b
+        flags |= FD_CLOEXEC;
9cf207b
+        if (fcntl(iw_socket, F_SETFD, flags) == -1)
9cf207b
+                return 0;
9cf207b
         if (iw_socket<0)
9cf207b
                 return 0;
9cf207b