Now config file is always writen to /etc/wh.config

This commit is contained in:
Lakindu 2020-05-06 15:25:20 +05:30
parent c399af64f9
commit 48d6928233
3 changed files with 9 additions and 8 deletions

View File

@ -98,7 +98,7 @@ const char *build_wh_mkconfig_command(ConfigValues* cv){
const char* a=get_config_file(CONFIG_FILE_NAME);
snprintf(cmd_mkconfig, BUFSIZE, "%s %s %s %s %s %s %s", CREATE_AP, cv->iface_wifi, cv->iface_inet, cv->ssid, cv->pass,MKCONFIG,a);
snprintf(cmd_mkconfig, BUFSIZE, "%s %s %s %s %s %s %s %s",SUDO, CREATE_AP, cv->iface_wifi, cv->iface_inet, cv->ssid, cv->pass,MKCONFIG,a);
if(cv->freq!=NULL){
strcat(cmd_mkconfig," --freq-band ");
@ -184,7 +184,7 @@ const char* build_kill_create_ap_command(char* pid){
static int init_get_running(){
const char* cmd="create_ap --list-running";
const char* cmd="pkexec --user root create_ap --list-running";
FILE *fp;
if ((fp = popen(cmd, "r")) == NULL) {

View File

@ -124,12 +124,13 @@ const char* get_config_file(const char* file){
static char a[BUFSIZE];
if ((homedir = getenv("HOME")) == nullptr) {
homedir = getpwuid(getuid())->pw_dir;
}
snprintf(a,BUFSIZE,"%s%s%s",homedir,"/",file);
// if ((homedir = getenv("HOME")) == nullptr) {
// homedir = getpwuid(getuid())->pw_dir;
// }
// snprintf(a,BUFSIZE,"%s%s%s",homedir,"/",file);
snprintf(a,BUFSIZE,"%s",file);
//printf(" from %s \n",a);
return (const char*)a;
}

View File

@ -68,7 +68,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define CONFIG_FILE_NAME ".wh.config"
#define CONFIG_FILE_NAME "/etc/wh.config"
#ifdef __cplusplus
extern "C" {