[PATCH] config-parser: Honor the XDG_CONFIG_DIRS environment variable
Kristian Høgsberg
krh at bitplanet.net
Mon May 13 12:10:52 PDT 2013
On Mon, May 13, 2013 at 10:37 AM, Daniel Stone <daniel at fooishbar.org> wrote:
> Hi,
>
> On 12 May 2013 16:54, Kristian Høgsberg <krh at bitplanet.net> wrote:
>> I think we can change the interface to int open_config_file(const char
>> *), which looks up and opens the config file and returns the fd. We
>> can keep that in weston_compositor instead of the config_file path.
>> The parse function can then fseek on the fd to reset to the beginning
>> of the file. Going forward, we'll do something like this:
>
> Totally. I've actually got a patch which looks in $sysconfdir and
> $datadir as well, enabling global fallback config files to be shipped,
> which I guess should be combined with this. When I looked at that, my
> next step was going to be returning an fd, but then I remembered that
> fds have no fgets() equivalent and totally lost interest in
> open-coding that.
We can use fdopen().
> But it would be a much better result, particularly as mine open()s the
> files to verify they're accessible anyway ...
Yeah, that was the point of returning an fd - to avoid the classic
access()/open() race (though I doubt it's a concern for a config
file).
Kristian
More information about the wayland-devel
mailing list