mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	dlsym: use the only alsa plugins directory for the internal modules
The commitb2a4272ecbintroduced a slightly different behaviour for ALSA_PLUGIN_DIR. The fallback causes that the alsa libraries are searched in all library directories. It was never intended to do the system wide library lookups for internal modules. Fixes:b2a4272ecb("snd_dlopen: do not use absolute plugin path for snd_dlopen() calls") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									2a204a5412
								
							
						
					
					
						commit
						aa89ad9362
					
				
					 1 changed files with 6 additions and 17 deletions
				
			
		
							
								
								
									
										23
									
								
								src/dlmisc.c
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								src/dlmisc.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -147,31 +147,20 @@ void *snd_dlopen(const char *name, int mode, char *errbuf, size_t errbuflen)
 | 
			
		|||
	 * via ld.so.conf.
 | 
			
		||||
	 */
 | 
			
		||||
	void *handle = NULL;
 | 
			
		||||
	const char *filename = NULL;
 | 
			
		||||
	const char *filename = name;
 | 
			
		||||
	char path[PATH_MAX];
 | 
			
		||||
 | 
			
		||||
	if (name && name[0] != '/') {
 | 
			
		||||
		if (snd_dlpath(path, sizeof(path), name) == 0) {
 | 
			
		||||
		if (snd_dlpath(path, sizeof(path), name) == 0)
 | 
			
		||||
			filename = path;
 | 
			
		||||
			handle = dlopen(filename, mode);
 | 
			
		||||
			if (!handle) {
 | 
			
		||||
				/* if the filename exists and cannot be opened */
 | 
			
		||||
				/* return immediately */
 | 
			
		||||
				if (access(filename, X_OK) == 0)
 | 
			
		||||
					goto errpath;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (!handle) {
 | 
			
		||||
		filename = name;
 | 
			
		||||
		handle = dlopen(name, mode);
 | 
			
		||||
		if (!handle)
 | 
			
		||||
			goto errpath;
 | 
			
		||||
	}
 | 
			
		||||
	handle = dlopen(filename, mode);
 | 
			
		||||
	if (!handle)
 | 
			
		||||
		goto errpath;
 | 
			
		||||
	return handle;
 | 
			
		||||
errpath:
 | 
			
		||||
	if (errbuf)
 | 
			
		||||
		snprintf(errbuf, errbuflen, "%s: %s", filename, dlerror());
 | 
			
		||||
		snprintf(errbuf, errbuflen, "%s", dlerror());
 | 
			
		||||
#endif
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue