mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05: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
				
			
		| 
						 | 
				
			
			@ -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