diff mbox

[5/5] amixer: use the same characters for separator.

Message ID 1428510659-30393-6-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Takashi Sakamoto April 8, 2015, 4:30 p.m. UTC
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@sakamocchi.jp>
---
 amixer/amixer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

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. */