zbyszek / rpms / pulseaudio

Forked from rpms/pulseaudio 5 years ago
Clone
Blob Blame History Raw
Attempt to resolve the multilib conflicts by getting all the config files
look equally for all plattforms.  This includes getting rid go pathnames
with libdir; let's make ps search for files with relative paths there.

https://bugzilla.redhat.com/show_bug.cgi?id=228383
Lubomir Kundrak <lkundrak@redhat.com>

diff -urp pulseaudio-0.9.8.orig/src/daemon/daemon.conf.in pulseaudio-0.9.8/src/daemon/daemon.conf.in
--- pulseaudio-0.9.8.orig/src/daemon/daemon.conf.in	2008-02-29 12:44:07.000000000 +0100
+++ pulseaudio-0.9.8/src/daemon/daemon.conf.in	2008-02-29 12:43:27.000000000 +0100
@@ -38,7 +38,7 @@
 ; module-idle-time = 20
 ; scache-idle-time = 20
 
-; dl-search-path = @PA_DLSEARCHPATH@
+; dl-search-path = (depends on architecture)
 
 ; default-script-file = @PA_DEFAULT_CONFIG_FILE@
 
diff -urp pulseaudio-0.9.8.orig/src/daemon/default.pa.in pulseaudio-0.9.8/src/daemon/default.pa.in
--- pulseaudio-0.9.8.orig/src/daemon/default.pa.in	2008-02-29 12:44:07.000000000 +0100
+++ pulseaudio-0.9.8/src/daemon/default.pa.in	2008-02-29 12:43:27.000000000 +0100
@@ -37,7 +37,7 @@ load-sample-lazy pulse-hotplug /usr/shar
 #load-module module-pipe-sink
 
 ### Automatically load driver modules depending on the hardware available
-.ifexists @PA_DLSEARCHPATH@/module-hal-detect@PA_SOEXT@
+.ifexists module-hal-detect@PA_SOEXT@
 load-module module-hal-detect
 .else
 ### Alternatively use the static hardware detection module (for systems that
@@ -79,7 +79,7 @@ load-module module-suspend-on-idle
 #load-module module-x11-bell sample=x11-bell
 
 ### Publish connection data in the X11 root window
-.ifexists @PA_DLSEARCHPATH@/module-x11-publish@PA_SOEXT@
+.ifexists module-x11-publish@PA_SOEXT@
 load-module module-x11-publish
 .endif
 
@@ -91,7 +91,7 @@ load-module module-x11-publish
 ### Load additional modules from GConf settings. This can be configured with the paprefs tool.
 ### Please keep in mind that the modules configured by paprefs might conflict with manually
 ### loaded modules.
-.ifexists @PA_DLSEARCHPATH@/module-gconf@PA_SOEXT@
+.ifexists module-gconf@PA_SOEXT@
 load-module module-gconf
 .endif
 
diff -urp pulseaudio-0.9.8.orig/src/pulsecore/cli-command.c pulseaudio-0.9.8/src/pulsecore/cli-command.c
--- pulseaudio-0.9.8.orig/src/pulsecore/cli-command.c	2008-02-29 12:44:07.000000000 +0100
+++ pulseaudio-0.9.8/src/pulsecore/cli-command.c	2008-02-29 12:44:48.000000000 +0100
@@ -31,6 +31,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
+#include <ltdl.h>
 
 #include <pulse/xmalloc.h>
 
@@ -1314,9 +1315,39 @@ int pa_cli_command_execute_line_stateful
                     return -1;
                 } else {
                     const char *filename = cs+l+strspn(cs+l, whitespace);
+                    char *saveptr = NULL; 
+                    char *paths;
+                    char *path;
+
+                    /* Search DL_SEARCH_PATH unless the filename is absolute */
+                    if (filename[0] == '/') {
+                        paths = strdup ("/");
+                    } else {
+                        paths = strdup (lt_dlgetsearchpath ());
+                    }
 
-                    *ifstate = access(filename, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE;
-                    pa_log_debug("Checking for existance of '%s': %s", filename, *ifstate == IFSTATE_TRUE ? "success" : "failure");
+                    if (paths == NULL)
+                        return -1;
+
+                    for (path = strtok_r (paths, ":", &saveptr); path; path = strtok_r (NULL, ":", &saveptr)) {
+                        char *pathname = malloc (strlen(path) + strlen(filename) + 2);
+                        if (pathname == NULL)
+                            return -1;
+                        pathname[0] = '\0';
+
+                        strcat(pathname, path);
+                        strcat(pathname, "/"); /* XXX: Is this OK for Windows? */
+                        strcat(pathname, filename);
+
+                        *ifstate = access(pathname, F_OK) == 0 ? IFSTATE_TRUE : IFSTATE_FALSE;
+                        pa_log_debug("Checking for existance of '%s': %s", pathname, *ifstate == IFSTATE_TRUE ? "success" : "failure");
+
+                        pa_xfree (pathname);
+
+                        if (*ifstate == IFSTATE_TRUE)
+                                break;
+                    }     
+                    pa_xfree (paths);
                 }
             } else {
                 pa_strbuf_printf(buf, "Invalid meta command: %s\n", cs);