mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
pulse: sanitize the remote name
We use the remote name as a suffix for the default server address and so it should not contain any slashes. Take everything after the last slash if there is one.
This commit is contained in:
parent
70ca546c6a
commit
546de65c67
1 changed files with 3 additions and 1 deletions
|
|
@ -148,12 +148,14 @@ pid_t get_client_pid(struct client *client, int client_fd)
|
|||
|
||||
const char *get_server_name(struct pw_context *context)
|
||||
{
|
||||
const char *name = NULL;
|
||||
const char *name = NULL, *sep;
|
||||
const struct pw_properties *props = pw_context_get_properties(context);
|
||||
|
||||
name = getenv("PIPEWIRE_REMOTE");
|
||||
if ((name == NULL || name[0] == '\0') && props != NULL)
|
||||
name = pw_properties_get(props, PW_KEY_REMOTE_NAME);
|
||||
if (name != NULL && (sep = strrchr(name, '/')) != NULL)
|
||||
name = sep+1;
|
||||
if (name == NULL || name[0] == '\0')
|
||||
name = PW_DEFAULT_REMOTE;
|
||||
return name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue