pulsecore: Make run-from-build not readlink() on every call

Since this is no longer only defined in debug builds, let's make sure
that there is no impact if this is indavertently called repeatedly at
startup.
This commit is contained in:
Arun Raghavan 2013-04-20 10:12:34 +05:30
parent 3d7bc637c4
commit 4c23720ef1

View file

@ -3209,12 +3209,14 @@ void pa_reset_personality(void) {
pa_bool_t pa_run_from_build_tree(void) {
char *rp;
pa_bool_t b = FALSE;
static pa_bool_t b = FALSE;
if ((rp = pa_readlink("/proc/self/exe"))) {
b = pa_startswith(rp, PA_BUILDDIR);
pa_xfree(rp);
}
PA_ONCE_BEGIN {
if ((rp = pa_readlink("/proc/self/exe"))) {
b = pa_startswith(rp, PA_BUILDDIR);
pa_xfree(rp);
}
} PA_ONCE_END;
return b;
}