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>
This commit is contained in:
Ossama Othman
2013-05-14 09:48:26 -07:00
committed by Kristian Høgsberg
parent 95eb3a2eb4
commit a50e6e4c50
22 changed files with 158 additions and 110 deletions
+10 -2
View File
@@ -24,7 +24,10 @@ server is started:
.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 @@ where environment variable
.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