config-parser: Honor XDG_CONFIG_DIRS
This set of changes adds support for searching for a given config file
in the directories listed in $XDG_CONFIG_DIRS if it wasn't found in
$XDG_CONFIG_HOME or ~/.config. This allows packages to install custom
config files in /etc/xdg/weston, for example, thus allowing them to
avoid dealing with home directories.
To avoid a TOCTOU race the config file is actually open()ed during the
search. Its file descriptor is returned and stored in the compositor
for later use when performing subsequent config file parses.
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
diff --git a/man/weston.ini.man b/man/weston.ini.man
index 2287730..d37654a 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -24,7 +24,10 @@
.nf
.BR "$XDG_CONFIG_HOME/weston.ini " "(if $XDG_CONFIG_HOME is set)"
.BR "$HOME/.config/weston.ini " "(if $HOME is set)"
-.BR "<current dir>/weston.ini " "(if both variables were not set)"
+.B "weston/weston.ini in each"
+.BR "\ \ \ \ $XDG_CONFIG_DIR " "(if $XDG_CONFIG_DIRS is set)"
+.BR "/etc/xdg/weston/weston.ini " "(if $XDG_CONFIG_DIRS is not set)"
+.BR "<current dir>/weston.ini " "(if no variables were set)"
.fi
.RE
.PP
@@ -32,7 +35,12 @@
.B $HOME
is the user's home directory, and
.B $XDG_CONFIG_HOME
-is the user specific configuration directory.
+is the user specific configuration directory, and
+.B $XDG_CONFIG_DIRS
+is a colon
+.B ':'
+delimited listed of configuration base directories, such as
+.BR /etc/xdg-foo:/etc/xdg .
.PP
The
.I weston.ini