Fix a bug in the mood line parser.
authorAndre Noll <maan@systemlinux.org>
Fri, 26 Oct 2007 00:21:35 +0000 (02:21 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 26 Oct 2007 00:21:35 +0000 (02:21 +0200)
The old code wouldn't work if the "if" keyword was not given.

mood.c

diff --git a/mood.c b/mood.c
index 77b4a7361554fa05ca36f7685114c2bd1b7ba68c..d6040f1592491fc087429f367621e81de4378f9f 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -419,11 +419,13 @@ static int parse_mood_line(char *mood_line, void *data)
                w++;
                if (!*w)
                        goto out;
-               if (!strcmp(*w, "with")) {
-                       w++;
-                       if (!*w)
-                               goto out;
-               }
+               if (strcmp(*w, "with"))
+                       goto check_for_if;
+               w++;
+               if (!*w)
+                       goto out;
+               if (strcmp(*w, "score"))
+                       goto out;
        }
        if (mlt == ML_SCORE || !strcmp(*w, "score")) {
                ret = -E_MOOD_SYNTAX;
@@ -446,6 +448,7 @@ static int parse_mood_line(char *mood_line, void *data)
        w++;
        if (!*w)
                goto out;
+check_for_if:
        if (!strcmp(*w, "if")) {
                ret = -E_MOOD_SYNTAX;
                w++;