fix loop over config files if none was found
if no file was found the string is just "\0" and neads a head controled while if no config file was found exit awesome with an error message (fail early!) Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
7795f623dd
commit
907a5379a3
|
@ -513,7 +513,8 @@ main(int argc, char **argv)
|
||||||
spawn_init();
|
spawn_init();
|
||||||
|
|
||||||
/* Parse and run configuration file */
|
/* Parse and run configuration file */
|
||||||
luaA_parserc(&xdg, confpath, true);
|
if (!luaA_parserc(&xdg, confpath, true))
|
||||||
|
fatal("couldn't find any rc file");
|
||||||
|
|
||||||
xdgWipeHandle(&xdg);
|
xdgWipeHandle(&xdg);
|
||||||
|
|
||||||
|
|
4
luaa.c
4
luaa.c
|
@ -835,7 +835,7 @@ luaA_parserc(xdgHandle* xdg, const char *confpatharg, bool run)
|
||||||
char *tmp = confpath;
|
char *tmp = confpath;
|
||||||
|
|
||||||
/* confpath is "string1\0string2\0string3\0\0" */
|
/* confpath is "string1\0string2\0string3\0\0" */
|
||||||
do
|
while(*tmp)
|
||||||
{
|
{
|
||||||
if(luaA_loadrc(tmp, run))
|
if(luaA_loadrc(tmp, run))
|
||||||
{
|
{
|
||||||
|
@ -845,7 +845,7 @@ luaA_parserc(xdgHandle* xdg, const char *confpatharg, bool run)
|
||||||
else if(!run)
|
else if(!run)
|
||||||
goto bailout;
|
goto bailout;
|
||||||
tmp += a_strlen(tmp) + 1;
|
tmp += a_strlen(tmp) + 1;
|
||||||
} while(*tmp != 0);
|
}
|
||||||
|
|
||||||
bailout:
|
bailout:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue