protocol: don't place sockets in $HOME

No server will put them there and no client will look for it there.
This commit is contained in:
Wim Taymans 2021-07-27 10:57:31 +02:00
parent b70a3dca85
commit 8e8cb34dc2
2 changed files with 2 additions and 17 deletions

View file

@ -65,16 +65,8 @@ get_runtime_dir(void)
runtime_dir = getenv("PIPEWIRE_RUNTIME_DIR"); runtime_dir = getenv("PIPEWIRE_RUNTIME_DIR");
if (runtime_dir == NULL) if (runtime_dir == NULL)
runtime_dir = getenv("XDG_RUNTIME_DIR"); runtime_dir = getenv("XDG_RUNTIME_DIR");
if (runtime_dir == NULL)
runtime_dir = getenv("HOME");
if (runtime_dir == NULL) if (runtime_dir == NULL)
runtime_dir = getenv("USERPROFILE"); 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; return runtime_dir;
} }

View file

@ -55,22 +55,15 @@ int get_runtime_dir(char *buf, size_t buflen, const char *dir)
{ {
const char *runtime_dir; const char *runtime_dir;
struct stat stat_buf; struct stat stat_buf;
char buffer[4096];
int res, size; int res, size;
runtime_dir = getenv("PULSE_RUNTIME_PATH"); runtime_dir = getenv("PULSE_RUNTIME_PATH");
if (runtime_dir == NULL) if (runtime_dir == NULL)
runtime_dir = getenv("XDG_RUNTIME_DIR"); 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) { 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; return -ENOENT;
} }