forked from enlightenment/efl
- if we can't parse the INI file we can't set ini->data so return NULL
instead of an invalid ini file SVN revision: 34493
This commit is contained in:
parent
bc35dd6189
commit
3624e4e923
|
@ -55,6 +55,7 @@ efreet_ini_new(const char *file)
|
||||||
if (!ini) return NULL;
|
if (!ini) return NULL;
|
||||||
|
|
||||||
ini->data = efreet_ini_parse(file);
|
ini->data = efreet_ini_parse(file);
|
||||||
|
if (!ini->data) FREE(ini);
|
||||||
|
|
||||||
return ini;
|
return ini;
|
||||||
}
|
}
|
||||||
|
@ -79,8 +80,7 @@ efreet_ini_parse(const char *file)
|
||||||
f = fopen(file, "rb");
|
f = fopen(file, "rb");
|
||||||
if (!f) return NULL;
|
if (!f) return NULL;
|
||||||
|
|
||||||
if (fstat(fileno(f), &file_stat)
|
if (fstat(fileno(f), &file_stat) || file_stat.st_size < 1)
|
||||||
|| file_stat.st_size < 1)
|
|
||||||
{
|
{
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -274,7 +274,7 @@ efreet_ini_save(Efreet_Ini *ini, const char *file)
|
||||||
EAPI int
|
EAPI int
|
||||||
efreet_ini_section_set(Efreet_Ini *ini, const char *section)
|
efreet_ini_section_set(Efreet_Ini *ini, const char *section)
|
||||||
{
|
{
|
||||||
if (!ini || !ini->data || !section) return 0;
|
if (!ini || !(ini->data) || !section) return 0;
|
||||||
|
|
||||||
ini->section = ecore_hash_get(ini->data, section);
|
ini->section = ecore_hash_get(ini->data, section);
|
||||||
return (ini->section ? 1 : 0);
|
return (ini->section ? 1 : 0);
|
||||||
|
|
Loading…
Reference in New Issue