[PATCH weston] compositor: Respect WESTON_BUILD_DIR env var in weston_load_module

Pekka Paalanen ppaalanen at gmail.com
Sun Jun 7 23:40:32 PDT 2015


On Fri,  5 Jun 2015 10:07:16 -0500
Derek Foreman <derekf at osg.samsung.com> wrote:

> We were loading modules out of the system dirs unconditionally, so
> tests that loaded modules would use the system ones, or fail if
> they weren't installed.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---
> 
>  src/compositor.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/src/compositor.c b/src/compositor.c
> index 8f02b4d..0a4186e 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -4906,15 +4906,19 @@ on_caught_signal(int s, siginfo_t *siginfo, void *context)
>  WL_EXPORT void *
>  weston_load_module(const char *name, const char *entrypoint)
>  {
> +	const char *builddir = getenv("WESTON_BUILD_DIR");
>  	char path[PATH_MAX];
>  	void *module, *init;
>  
>  	if (name == NULL)
>  		return NULL;
>  
> -	if (name[0] != '/')
> -		snprintf(path, sizeof path, "%s/%s", MODULEDIR, name);
> -	else
> +	if (name[0] != '/') {
> +		if (builddir)
> +			snprintf(path, sizeof path, "%s/.libs/%s", builddir, name);
> +		else
> +			snprintf(path, sizeof path, "%s/%s", MODULEDIR, name);
> +	} else
>  		snprintf(path, sizeof path, "%s", name);
>  
>  	module = dlopen(path, RTLD_NOW | RTLD_NOLOAD);

Hi,

needs braces also for the else-branch.

We already have weston_config_get_libexec_dir(), but since all modules
are loaded via weston_load_module(), this patch is good. No need to
invent a weston_config_get_modules_dir().

Reviewed-By: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq


More information about the wayland-devel mailing list