]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsaucm: Fix ending with quotes commands
authorCheng Yueh <cyueh@chromium.org>
Thu, 9 Jul 2020 06:24:12 +0000 (14:24 +0800)
committerJaroslav Kysela <perex@perex.cz>
Mon, 27 Jul 2020 09:56:47 +0000 (11:56 +0200)
If we use 'alsaucm -n -b -' with 'get "CapturePCM/Internal Mic"' then
the alsaucm will report error and stop immediately. The reason is that
the parse_line in usecase.c appends an empty argument if a command ends
with quotes.

This change adds a patch to fix the parse_line function in usecase.c.

Signed-off-by: Cheng Yueh <cyueh@chromium.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsaucm/usecase.c

index 1ed91ea56863b106da841841a6def0af73355fb9..d39a15951a52de496f218f1b9aeece4b425936cd 100644 (file)
@@ -130,6 +130,8 @@ static int parse_line(struct context *context, char *line)
                                                        *line == '\n'))
                        line++;
                c = *line;
+               if (c == '\0')
+                       return 0;
                if (c == '\"' || c == '\'') {
                        start = ++line;
                        while (*line && *line != c)