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