]> git.tue.mpg.de Git - paraslash.git/commitdiff
audiod: Print a warning if filters are ignored.
authorAndre Noll <maan@systemlinux.org>
Mon, 2 Sep 2013 01:46:32 +0000 (01:46 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 22 Sep 2013 00:29:18 +0000 (02:29 +0200)
If the regular expression of a filter specifier does not match any
audio formats, we ignore this filter spec silently. Most likely this
was not intended and deserves a log message, so let's add it.

audiod.c

index 64925b76e6e6d3500186670ec5d4bf5e9f91dd08..5ed7067325ab526132fd80a18f06b4633a993e79 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -914,7 +914,7 @@ out:
 
 static int parse_filter_args(void)
 {
-       int i, j, ret, af_mask;
+       int i, j, ret, af_mask, num_matches;
 
        for (i = 0; i < conf.filter_given; i++) {
                char *arg;
@@ -922,13 +922,18 @@ static int parse_filter_args(void)
                if (ret < 0)
                        goto out;
                af_mask = ret;
+               num_matches = 0;
                FOR_EACH_AUDIO_FORMAT(j) {
                        if ((af_mask & (1 << j)) == 0) /* no match */
                                continue;
                        ret = add_filter(j, arg);
                        if (ret < 0)
                                goto out;
+                       num_matches++;
                }
+               if (num_matches == 0)
+                       PARA_WARNING_LOG("ignoring filter spec: %s\n",
+                               conf.filter_arg[i]);
        }
        ret = init_default_filters(); /* use default values for the rest */
 out: