mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-29 14:56:21 +00:00
Fix regression concerning the reading and the creation of .linphonerc
The .linphonerc file was not created at the first launch of Linphone. The realpath function fails and returns NULL when passing a path which points on an empty file.
This commit is contained in:
parent
fbc7b86f1e
commit
6d3d8a8f3d
1 changed files with 13 additions and 1 deletions
|
|
@ -370,7 +370,15 @@ LpConfig *lp_config_new_with_factory(const char *config_filename, const char *fa
|
|||
LpConfig *lpconfig=lp_new0(LpConfig,1);
|
||||
lpconfig->refcnt=1;
|
||||
if (config_filename!=NULL){
|
||||
lpconfig->filename=lp_realpath(config_filename, NULL);
|
||||
if(access(config_filename, F_OK) == 0) {
|
||||
lpconfig->filename=lp_realpath(config_filename, NULL);
|
||||
if(lpconfig->filename == NULL) {
|
||||
ms_error("Could not find the real path of %s: %s", config_filename, strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
lpconfig->filename = ms_strdup(config_filename);
|
||||
}
|
||||
lpconfig->tmpfilename=ortp_strdup_printf("%s.tmp",lpconfig->filename);
|
||||
ms_message("Using (r/w) config information from %s", lpconfig->filename);
|
||||
|
||||
|
|
@ -408,6 +416,10 @@ LpConfig *lp_config_new_with_factory(const char *config_filename, const char *fa
|
|||
lp_config_read_file(lpconfig, factory_config_filename);
|
||||
}
|
||||
return lpconfig;
|
||||
|
||||
fail:
|
||||
ms_free(lpconfig);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int lp_config_read_file(LpConfig *lpconfig, const char *filename){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue