summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-08-07 02:39:58 +0200
committerLennart Poettering <lennart@poettering.net>2008-08-07 02:39:58 +0200
commit40ff5fa06f4c9749e4bee9a8c2b18fe50e1210ab (patch)
tree01538e9017728175ab7e8bb5e957985382a35a6a /src/pulse
parent75b28e97fa612d9dfdad60e37f6901a8923b92f4 (diff)
add compatibility with older PA socket paths
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/context.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 5be4078b..bdd519a6 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -776,7 +776,7 @@ finish:
}
-static char *get_legacy_runtime_dir(void) {
+static char *get_old_legacy_runtime_dir(void) {
char *p, u[128];
struct stat st;
@@ -798,6 +798,28 @@ static char *get_legacy_runtime_dir(void) {
return p;
}
+static char *get_very_old_legacy_runtime_dir(void) {
+ char *p, h[128];
+ struct stat st;
+
+ if (!pa_get_home_dir(h, sizeof(h)))
+ return NULL;
+
+ p = pa_sprintf_malloc("%s/.pulse", h);
+
+ if (stat(p, &st) < 0) {
+ pa_xfree(p);
+ return NULL;
+ }
+
+ if (st.st_uid != getuid()) {
+ pa_xfree(p);
+ return NULL;
+ }
+
+ return p;
+}
+
int pa_context_connect(
pa_context *c,
const char *server,
@@ -849,8 +871,16 @@ int pa_context_connect(
/* The system wide instance */
c->server_list = pa_strlist_prepend(c->server_list, PA_SYSTEM_RUNTIME_PATH PA_PATH_SEP PA_NATIVE_DEFAULT_UNIX_SOCKET);
- /* The old per-user instance path. This is supported only to ease upgrades */
- if ((legacy_dir = get_legacy_runtime_dir())) {
+ /* The very old per-user instance path (< 0.9.11). This is supported only to ease upgrades */
+ if ((legacy_dir = get_very_old_legacy_runtime_dir())) {
+ char *p = pa_sprintf_malloc("%s" PA_PATH_SEP PA_NATIVE_DEFAULT_UNIX_SOCKET, legacy_dir);
+ c->server_list = pa_strlist_prepend(c->server_list, p);
+ pa_xfree(p);
+ pa_xfree(legacy_dir);
+ }
+
+ /* The old per-user instance path (< 0.9.12). This is supported only to ease upgrades */
+ if ((legacy_dir = get_old_legacy_runtime_dir())) {
char *p = pa_sprintf_malloc("%s" PA_PATH_SEP PA_NATIVE_DEFAULT_UNIX_SOCKET, legacy_dir);
c->server_list = pa_strlist_prepend(c->server_list, p);
pa_xfree(p);