[alsa-devel] [PATCH 5/5] amixer: use the same characters for separator.

Takashi Sakamoto o-takashi at sakamocchi.jp
Wed Apr 8 18:30:58 CEST 2015


The arguments are parsed as the value of each channel for enumerated
element in sset_enum() and get_enum_item_index(), the former is
a caller and the latter is a callee. Both of them evaluate the string
but use different characters for separator. This brings just cofusion
to users.

This commit fix this bug, by changing callee's characters according to
caller's characters.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 amixer/amixer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/amixer/amixer.c b/amixer/amixer.c
index aec8d01..fa4bde1 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -1276,8 +1276,8 @@ static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp)
 		if (strncmp(name, ptr, len) != 0)
 			continue;
 
-		/* Lack of separators between channels. */
-		if (ptr[len] != '\0' && ptr[len] != ',' && ptr[len] != '\n')
+		/* Lack of string terminator and separator between channels. */
+		if (ptr[len] != '\0' && ptr[len] != ',' && !isspace(ptr[len]))
 			continue;
 
 		/* OK. The string is exactly one of items. */
-- 
2.1.0



More information about the Alsa-devel mailing list