From c9bd787fd6e3728b0abd9b309e24047d7f659cb7 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 13 Jan 2018 03:33:25 +0100 Subject: [PATCH] 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 --- awesome.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awesome.c b/awesome.c index 4844a0e94..3513cecf4 100644 --- a/awesome.c +++ b/awesome.c @@ -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);