diff options
author | Ossama Othman <ossama.othman@intel.com> | 2013-05-14 09:48:26 -0700 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-05-14 14:36:37 -0400 |
commit | a50e6e4c500e3080b8df7ec14c7e42741477a423 (patch) | |
tree | 0cae5b3f325814e7f2d859eaa3f2c2415c69eb33 /src/compositor-headless.c | |
parent | 95eb3a2eb470bd341ab078c7e48a28ffebc6dde1 (diff) |
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>
Diffstat (limited to 'src/compositor-headless.c')
-rw-r--r-- | src/compositor-headless.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compositor-headless.c b/src/compositor-headless.c index 47203294..0df0f7db 100644 --- a/src/compositor-headless.c +++ b/src/compositor-headless.c @@ -158,7 +158,7 @@ headless_destroy(struct weston_compositor *ec) static struct weston_compositor * headless_compositor_create(struct wl_display *display, int width, int height, const char *display_name, - int *argc, char *argv[], const char *config_file) + int *argc, char *argv[], int config_fd) { struct headless_compositor *c; @@ -169,7 +169,7 @@ headless_compositor_create(struct wl_display *display, 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->fake_seat, &c->base); @@ -194,7 +194,7 @@ err_free: WL_EXPORT struct weston_compositor * backend_init(struct wl_display *display, int *argc, char *argv[], - const char *config_file) + int config_fd) { int width = 1024, height = 640; char *display_name = NULL; @@ -208,5 +208,5 @@ backend_init(struct wl_display *display, int *argc, char *argv[], ARRAY_LENGTH(headless_options), argc, argv); return headless_compositor_create(display, width, height, display_name, - argc, argv, config_file); + argc, argv, config_fd); } |