mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pulse-server: support absolute unix socket paths
If a unix socket address starts with '/', use it directly as an absolute path, do not prepend the runtime directory.
This commit is contained in:
parent
70c6e6ccc8
commit
ebed44db79
2 changed files with 15 additions and 7 deletions
|
|
@ -33,6 +33,7 @@ context.modules = [
|
|||
# the addresses this server listens on
|
||||
server.address = [
|
||||
"unix:native"
|
||||
# "unix:/tmp/something" # absolute paths may be used
|
||||
# "tcp:4713" # IPv4 and IPv6 on all addresses
|
||||
# "tcp:[::]:9999" # IPv6 on all addresses
|
||||
# "tcp:127.0.0.1:8888" # IPv4 on a single address
|
||||
|
|
|
|||
|
|
@ -5871,21 +5871,28 @@ get_server_name(struct pw_context *context)
|
|||
static int parse_unix_address(const char *address, struct pw_array *addrs)
|
||||
{
|
||||
struct sockaddr_un addr = {0}, *s;
|
||||
char runtime_dir[PATH_MAX];
|
||||
int res;
|
||||
|
||||
if ((res = get_runtime_dir(runtime_dir, sizeof(runtime_dir), "pulse")) < 0)
|
||||
return res;
|
||||
if (address[0] != '/') {
|
||||
char runtime_dir[PATH_MAX];
|
||||
|
||||
res = snprintf(addr.sun_path, sizeof(addr.sun_path),
|
||||
"%s/%s", runtime_dir, address);
|
||||
if ((res = get_runtime_dir(runtime_dir, sizeof(runtime_dir), "pulse")) < 0)
|
||||
return res;
|
||||
|
||||
res = snprintf(addr.sun_path, sizeof(addr.sun_path),
|
||||
"%s/%s", runtime_dir, address);
|
||||
}
|
||||
else {
|
||||
res = snprintf(addr.sun_path, sizeof(addr.sun_path),
|
||||
"%s", address);
|
||||
}
|
||||
|
||||
if (res < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if ((size_t) res >= sizeof(addr.sun_path)) {
|
||||
pw_log_error(NAME": '%s/%s' too long",
|
||||
runtime_dir, address);
|
||||
pw_log_warn(NAME": '%s...' too long",
|
||||
addr.sun_path);
|
||||
return -ENAMETOOLONG;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue