mirror of
https://github.com/lakinduakash/linux-wifi-hotspot.git
synced 2025-02-16 07:30:09 +00:00
Fix not showing multiple wifi interfaces
This commit is contained in:
parent
ec4a82df94
commit
b7d78cb544
@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "read_config.h"
|
#include "read_config.h"
|
||||||
|
|
||||||
|
|
||||||
#define BUFSIZE 1024
|
#define BUFSIZE 2048
|
||||||
|
|
||||||
|
|
||||||
#define SUDO "pkexec --user root"
|
#define SUDO "pkexec --user root"
|
||||||
@ -284,15 +284,16 @@ static int init_get_interface_list(){
|
|||||||
const char* cmd="echo $( ls /sys/class/net ) ";
|
const char* cmd="echo $( ls /sys/class/net ) ";
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
char temp_buff[1024];
|
||||||
|
|
||||||
if ((fp = popen(cmd, "r")) == NULL) {
|
if ((fp = popen(cmd, "r")) == NULL) {
|
||||||
printf("Error opening pipe!\n");
|
printf("Error opening pipe!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(interface_list, BUFSIZE, fp) != NULL) {
|
while (fgets(temp_buff, sizeof(temp_buff), fp) != NULL) {
|
||||||
// Do whatever you want here...
|
|
||||||
//printf("%s", h_running_info);
|
strcat(interface_list,temp_buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pclose(fp)) {
|
if (pclose(fp)) {
|
||||||
@ -357,13 +358,17 @@ static int init_get_wifi_interface_list(){
|
|||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
char temp_buff[1048];
|
||||||
|
|
||||||
if ((fp = popen(cmd, "r")) == NULL) {
|
if ((fp = popen(cmd, "r")) == NULL) {
|
||||||
printf("Error opening pipe!\n");
|
printf("Error opening pipe!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(wifi_interface_list, BUFSIZE, fp) != NULL) {
|
|
||||||
// Do whatever you want here...
|
while (fgets(temp_buff, sizeof(temp_buff), fp) != NULL) {
|
||||||
|
|
||||||
|
strcat(wifi_interface_list,temp_buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pclose(fp)) {
|
if (pclose(fp)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user