Check for xdgInitHandle() failures (#2146)

Before this, running "env -i ./awesome" resulted in a segfault. This was
because xdgInitHandle() failed and the following
xdgSearchableConfigDirectories() followed a NULL pointer.

After this commit, awesome fails with an error message.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-01-13 03:33:25 +01:00 committed by Emmanuel Lepage Vallée
parent 5c6e25fe0a
commit c9bd787fd6
1 changed files with 2 additions and 1 deletions

View File

@ -585,7 +585,8 @@ main(int argc, char **argv)
}
/* Get XDG basedir data */
xdgInitHandle(&xdg);
if(!xdgInitHandle(&xdg))
fatal("Function xdgInitHandle() failed, is $HOME unset?");
/* add XDG_CONFIG_DIR as include path */
const char * const *xdgconfigdirs = xdgSearchableConfigDirectories(&xdg);