Various bugfixes

This commit is contained in:
CTCaer
2019-08-28 01:08:57 +03:00
parent e07dde1c58
commit 3472e7e7fb
19 changed files with 60 additions and 63 deletions

View File

@@ -56,7 +56,7 @@ int create_config_entry()
if (!sd_mount())
return 1;
char lbuf[16];
char lbuf[32];
FIL fp;
bool mainIniFound = false;

View File

@@ -35,7 +35,7 @@ static char *_strdup(char *str)
strcpy(res, str);
// Remove trailing space.
if (res[strlen(res) - 1] == ' ' && strlen(res))
if (strlen(res) && res[strlen(res) - 1] == ' ')
res[strlen(res) - 1] = 0;
return res;
@@ -180,22 +180,14 @@ int ini_parse(link_t *dst, char *ini_path, bool is_dir)
char *ini_check_payload_section(ini_sec_t *cfg)
{
char *path = NULL;
if (cfg == NULL)
return NULL;
LIST_FOREACH_ENTRY(ini_kv_t, kv, &cfg->kvs, link)
{
if (!strcmp("payload", kv->key))
{
if (!path)
path = _strdup(kv->val);
}
return kv->val;
}
if (path)
return path;
else
return NULL;
return NULL;
}