luaa: return parsing error right away
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
bcfdc290db
commit
e81fd419c3
13
luaa.c
13
luaa.c
|
@ -976,8 +976,6 @@ luaA_init(void)
|
|||
|
||||
static bool
|
||||
luaA_loadrc(const char *confpath, bool run)
|
||||
{
|
||||
if(confpath)
|
||||
{
|
||||
if(!luaL_loadfile(globalconf.L, confpath))
|
||||
{
|
||||
|
@ -997,7 +995,7 @@ luaA_loadrc(const char *confpath, bool run)
|
|||
}
|
||||
else
|
||||
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1015,11 +1013,16 @@ luaA_parserc(const char *confpatharg, bool run)
|
|||
bool ret = false;
|
||||
|
||||
/* try to load, return if it's ok */
|
||||
if(confpatharg)
|
||||
{
|
||||
if(luaA_loadrc(confpatharg, run))
|
||||
{
|
||||
ret = true;
|
||||
goto bailout;
|
||||
}
|
||||
else if(!run)
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
if((confdir = getenv("XDG_CONFIG_HOME")))
|
||||
a_asprintf(&confpath, "%s" AWESOME_CONFIG_FILE, confdir);
|
||||
|
@ -1032,6 +1035,8 @@ luaA_parserc(const char *confpatharg, bool run)
|
|||
ret = true;
|
||||
goto bailout;
|
||||
}
|
||||
else if(!run)
|
||||
goto bailout;
|
||||
|
||||
p_delete(&confpath);
|
||||
|
||||
|
@ -1053,6 +1058,8 @@ luaA_parserc(const char *confpatharg, bool run)
|
|||
ret = true;
|
||||
goto bailout;
|
||||
}
|
||||
else if(!run)
|
||||
goto bailout;
|
||||
p_delete(&confpath);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue