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/src/compositor-rdp.c b/src/compositor-rdp.c
index 51ef475..0dae963 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -928,7 +928,7 @@
static struct weston_compositor *
rdp_compositor_create(struct wl_display *display,
struct rdp_compositor_config *config,
- int *argc, char *argv[], const char *config_file)
+ int *argc, char *argv[], int config_fd)
{
struct rdp_compositor *c;
char *fd_str;
@@ -941,7 +941,7 @@
memset(c, 0, sizeof *c);
if (weston_compositor_init(&c->base, display, argc, argv,
- config_file) < 0)
+ config_fd) < 0)
goto err_free;
weston_seat_init(&c->main_seat, &c->base);