softap: Fix for hostapd.conf corruption
SoftAP fails to load the default hostapd.conf file which was left behind as part of failed attempt to start the softAP. The default hostapd.conf is required to be copied in case of accidental corruption of hostapd.conf Change-Id: I4e6ab7a6bc67fcdcfe225e7e1a811fafe402ebc7 CRs-Fixed: 626022
This commit is contained in:
@@ -3172,6 +3172,20 @@ int qsapsetSoftap(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int check_for_config_file_size(FILE *fp)
|
||||
{
|
||||
int length = 0;
|
||||
|
||||
if( NULL != fp )
|
||||
{
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
length = ftell(fp);
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
void check_for_configuration_files(void)
|
||||
{
|
||||
FILE * fp;
|
||||
@@ -3184,6 +3198,11 @@ void check_for_configuration_files(void)
|
||||
wifi_qsap_reset_to_default(CONFIG_FILE, DEFAULT_CONFIG_FILE_PATH);
|
||||
}
|
||||
else {
|
||||
|
||||
/* The configuration file could be of 0 byte size, replace with default */
|
||||
if (check_for_config_file_size(fp) <= 0)
|
||||
wifi_qsap_reset_to_default(CONFIG_FILE, DEFAULT_CONFIG_FILE_PATH);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
@@ -3192,6 +3211,11 @@ void check_for_configuration_files(void)
|
||||
wifi_qsap_reset_to_default(ACCEPT_LIST_FILE, DEFAULT_ACCEPT_LIST_FILE_PATH);
|
||||
}
|
||||
else {
|
||||
|
||||
/* The configuration file could be of 0 byte size, replace with default */
|
||||
if (check_for_config_file_size(fp) <= 0)
|
||||
wifi_qsap_reset_to_default(ACCEPT_LIST_FILE, DEFAULT_ACCEPT_LIST_FILE_PATH);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
@@ -3200,6 +3224,11 @@ void check_for_configuration_files(void)
|
||||
wifi_qsap_reset_to_default(DENY_LIST_FILE, DEFAULT_DENY_LIST_FILE_PATH);
|
||||
}
|
||||
else {
|
||||
|
||||
/* The configuration file could be of 0 byte size, replace with default */
|
||||
if (check_for_config_file_size(fp) <= 0)
|
||||
wifi_qsap_reset_to_default(DENY_LIST_FILE, DEFAULT_DENY_LIST_FILE_PATH);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user