mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	topology: fix tplg_get_integer() - handle errno == ERANGE
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									5925a6d870
								
							
						
					
					
						commit
						1047a5f3c0
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -36,14 +36,19 @@ int tplg_get_integer(snd_config_t *n, int *val, int base)
 | 
			
		|||
		if (err < 0)
 | 
			
		||||
			return err;
 | 
			
		||||
		if (lval < INT_MIN || lval > INT_MAX)
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
			return -ERANGE;
 | 
			
		||||
		*val = lval;
 | 
			
		||||
		return err;
 | 
			
		||||
	case SND_CONFIG_TYPE_STRING:
 | 
			
		||||
		err = snd_config_get_string(n, &str);
 | 
			
		||||
		if (err < 0)
 | 
			
		||||
			return err;
 | 
			
		||||
		errno = 0;
 | 
			
		||||
		*val = strtol(str, NULL, base);
 | 
			
		||||
		if (errno == ERANGE)
 | 
			
		||||
			return -ERANGE;
 | 
			
		||||
		if (errno && *val == 0)
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
		return 0;
 | 
			
		||||
	default:
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue