char *conf = NULL;
char *old_conf;
char buf[HOSTAPD_CONF_LEN] = "";
- FILE *fp = NULL;
+ int fd = -1;
int ret;
char key[MOBILE_AP_WIFI_KEY_MAX_LEN + 1];
char *hw_mode = NULL;
WMESH_LOGD("Open connection [%s]", security); /* LCOV_EXCL_LINE */
}
- fp = fopen(HOSTAPD_MESH_CONF_FILE, "w");
- if (NULL == fp) {
+ fd = open(HOSTAPD_MESH_CONF_FILE, O_WRONLY | O_CREAT | O_TRUNC, 0640);
+ if (fd < 0) {
/* LCOV_EXCL_START */
WMESH_LOGE("Could not create the file [%s].", HOSTAPD_MESH_CONF_FILE);
g_free(conf);
}
if (conf) {
- fputs(conf, fp);
+ write(fd, conf, strlen(conf));
g_free(conf);
}
- fclose(fp);
+
+ close(fd);
return WMESHD_ERROR_NONE;
}