From 3d7bc637c4c4b556df5ecd08915300ecfd93bde8 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Sat, 20 Apr 2013 09:50:38 +0530 Subject: [PATCH] daemon: Fix dlsearchpath while running from build tree It appears that, libltdl will find the .la file in the builddir and figure out where the real .so is. This also requires .ifexists to be fixed up to correspondingly search in /.libs. --- src/daemon/daemon-conf.c | 2 +- src/pulsecore/cli-command.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index 2c43cf9c1..f1e5476a9 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -156,7 +156,7 @@ pa_daemon_conf *pa_daemon_conf_new(void) { #else if (pa_run_from_build_tree()) { pa_log_notice("Detected that we are run from the build tree, fixing search path."); - c->dl_search_path = pa_xstrdup(PA_BUILDDIR "/.libs/"); + c->dl_search_path = pa_xstrdup(PA_BUILDDIR); } else c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH); #endif diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index 1ec805411..f5489d6ea 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -2062,11 +2062,21 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b char *pathname; pathname = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", p, filename); - pa_xfree(p); *ifstate = access(pathname, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE; pa_log_debug("Checking for existence of '%s': %s", pathname, *ifstate == IFSTATE_TRUE ? "success" : "failure"); + if (PA_UNLIKELY(pa_run_from_build_tree())) { + /* If run from the build tree, search in /.libs as well */ + char *ltpathname = pa_sprintf_malloc("%s" PA_PATH_SEP ".libs" PA_PATH_SEP "%s", p, filename); + + *ifstate = access(ltpathname, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE; + pa_log_debug("Checking for existence of '%s': %s", ltpathname, *ifstate == IFSTATE_TRUE ? "success" : "failure"); + + pa_xfree(ltpathname); + } + + pa_xfree(p); pa_xfree(pathname); if (*ifstate == IFSTATE_TRUE)