From 907a5379a30c04d86d08046993cde2b61401df43 Mon Sep 17 00:00:00 2001 From: "M. Dietrich" Date: Mon, 1 Jun 2009 13:01:31 +0200 Subject: [PATCH] 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 --- awesome.c | 3 ++- luaa.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/awesome.c b/awesome.c index 321d98e42..4e0775f80 100644 --- a/awesome.c +++ b/awesome.c @@ -513,7 +513,8 @@ main(int argc, char **argv) spawn_init(); /* 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); diff --git a/luaa.c b/luaa.c index 46dbee209..fb173c7b6 100644 --- a/luaa.c +++ b/luaa.c @@ -835,7 +835,7 @@ luaA_parserc(xdgHandle* xdg, const char *confpatharg, bool run) char *tmp = confpath; /* confpath is "string1\0string2\0string3\0\0" */ - do + while(*tmp) { if(luaA_loadrc(tmp, run)) { @@ -845,7 +845,7 @@ luaA_parserc(xdgHandle* xdg, const char *confpatharg, bool run) else if(!run) goto bailout; tmp += a_strlen(tmp) + 1; - } while(*tmp != 0); + } bailout: