diff options
author | Jaroslav Kysela <perex@perex.cz> | 2019-12-14 13:52:18 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2020-01-03 23:38:08 +0100 |
commit | 1047a5f3c0d39a3b0579db027f52d7facdf44077 (patch) | |
tree | 810a009f34116788bce71fb689b716abbda32143 | |
parent | 5925a6d870331c631f85ed4e18a8c5e6459b3c36 (diff) | |
download | alsa-lib-1047a5f3c0d39a3b0579db027f52d7facdf44077.tar.gz |
topology: fix tplg_get_integer() - handle errno == ERANGE
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | src/topology/parser.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/topology/parser.c b/src/topology/parser.c index 7e657809..667c8d45 100644 --- a/src/topology/parser.c +++ b/src/topology/parser.c @@ -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; |