From 8e8cb34dc2d47cb8ef981cc09ec2f4c2e48d4e0d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 27 Jul 2021 10:57:31 +0200 Subject: [PATCH] protocol: don't place sockets in $HOME No server will put them there and no client will look for it there. --- src/modules/module-protocol-native/local-socket.c | 8 -------- src/modules/module-protocol-pulse/utils.c | 11 ++--------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/modules/module-protocol-native/local-socket.c b/src/modules/module-protocol-native/local-socket.c index 6cffcdea3..31a0801e8 100644 --- a/src/modules/module-protocol-native/local-socket.c +++ b/src/modules/module-protocol-native/local-socket.c @@ -65,16 +65,8 @@ get_runtime_dir(void) runtime_dir = getenv("PIPEWIRE_RUNTIME_DIR"); if (runtime_dir == NULL) runtime_dir = getenv("XDG_RUNTIME_DIR"); - if (runtime_dir == NULL) - runtime_dir = getenv("HOME"); if (runtime_dir == NULL) runtime_dir = getenv("USERPROFILE"); - if (runtime_dir == NULL) { - struct passwd pwd, *result = NULL; - char buffer[4096]; - if (getpwuid_r(getuid(), &pwd, buffer, sizeof(buffer), &result) == 0) - runtime_dir = result ? result->pw_dir : NULL; - } return runtime_dir; } diff --git a/src/modules/module-protocol-pulse/utils.c b/src/modules/module-protocol-pulse/utils.c index e3e2110dc..2ec430b37 100644 --- a/src/modules/module-protocol-pulse/utils.c +++ b/src/modules/module-protocol-pulse/utils.c @@ -55,22 +55,15 @@ int get_runtime_dir(char *buf, size_t buflen, const char *dir) { const char *runtime_dir; struct stat stat_buf; - char buffer[4096]; int res, size; runtime_dir = getenv("PULSE_RUNTIME_PATH"); if (runtime_dir == NULL) runtime_dir = getenv("XDG_RUNTIME_DIR"); - if (runtime_dir == NULL) - runtime_dir = getenv("HOME"); - if (runtime_dir == NULL) { - struct passwd pwd, *result = NULL; - if (getpwuid_r(getuid(), &pwd, buffer, sizeof(buffer), &result) == 0) - runtime_dir = result ? result->pw_dir : NULL; - } if (runtime_dir == NULL) { - pw_log_error(NAME": could not find a suitable runtime directory"); + pw_log_error(NAME": could not find a suitable runtime directory in" + "$PULSE_RUNTIME_PATH and $XDG_RUNTIME_DIR"); return -ENOENT; }