mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	conf: fix the include paths support
I omitted to use parent paths and the proper error code
when no paths are defined.
Fixes: f600310954 ("conf: improve the include paths code")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
			
			
This commit is contained in:
		
							parent
							
								
									6a76c01a01
								
							
						
					
					
						commit
						39fda8a69a
					
				
					 1 changed files with 15 additions and 12 deletions
				
			
		
							
								
								
									
										13
									
								
								src/conf.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								src/conf.c
									
										
									
									
									
								
							| 
						 | 
					@ -610,12 +610,12 @@ static char *_snd_config_path(const char *name)
 | 
				
			||||||
 *    These directories should be subdirectories of /usr/share/alsa.
 | 
					 *    These directories should be subdirectories of /usr/share/alsa.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int input_stdio_open(snd_input_t **inputp, const char *file,
 | 
					static int input_stdio_open(snd_input_t **inputp, const char *file,
 | 
				
			||||||
			    struct list_head *include_paths)
 | 
								    struct filedesc *current)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct list_head *pos;
 | 
						struct list_head *pos;
 | 
				
			||||||
	struct include_path *path;
 | 
						struct include_path *path;
 | 
				
			||||||
	char full_path[PATH_MAX];
 | 
						char full_path[PATH_MAX];
 | 
				
			||||||
	int err = 0;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (file[0] == '/')
 | 
						if (file[0] == '/')
 | 
				
			||||||
		return snd_input_stdio_open(inputp, file, "r");
 | 
							return snd_input_stdio_open(inputp, file, "r");
 | 
				
			||||||
| 
						 | 
					@ -623,7 +623,9 @@ static int input_stdio_open(snd_input_t **inputp, const char *file,
 | 
				
			||||||
	/* search file in user specified include paths. These directories
 | 
						/* search file in user specified include paths. These directories
 | 
				
			||||||
	 * are subdirectories of /usr/share/alsa.
 | 
						 * are subdirectories of /usr/share/alsa.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	list_for_each(pos, include_paths) {
 | 
						err = -ENOENT;
 | 
				
			||||||
 | 
						while (current) {
 | 
				
			||||||
 | 
							list_for_each(pos, ¤t->include_paths) {
 | 
				
			||||||
			path = list_entry(pos, struct include_path, list);
 | 
								path = list_entry(pos, struct include_path, list);
 | 
				
			||||||
			if (!path->dir)
 | 
								if (!path->dir)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
| 
						 | 
					@ -633,6 +635,8 @@ static int input_stdio_open(snd_input_t **inputp, const char *file,
 | 
				
			||||||
			if (err == 0)
 | 
								if (err == 0)
 | 
				
			||||||
				return 0;
 | 
									return 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							current = current->next;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -804,8 +808,7 @@ static int get_char_skip_comments(input_t *input)
 | 
				
			||||||
				str = tmp;
 | 
									str = tmp;
 | 
				
			||||||
				err = snd_input_stdio_open(&in, str, "r");
 | 
									err = snd_input_stdio_open(&in, str, "r");
 | 
				
			||||||
			} else { /* absolute or relative file path */
 | 
								} else { /* absolute or relative file path */
 | 
				
			||||||
				err = input_stdio_open(&in, str,
 | 
									err = input_stdio_open(&in, str, input->current);
 | 
				
			||||||
						&input->current->include_paths);
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (err < 0) {
 | 
								if (err < 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue