dvb-file: Fix error message for some unknown file formats
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 19 Aug 2012 19:46:22 +0000 (16:46 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 19 Aug 2012 19:53:05 +0000 (16:53 -0300)
This also solves a bug when parsing ATSC tables.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
lib/libdvbv5/dvb-file.c

index 2c8905ea1e85e86c132b01a899584e8e21e97477..f14389f9b9b615bef6dddf64cf4007a67a10ffd4 100644 (file)
@@ -106,15 +106,23 @@ struct dvb_file *parse_format_oneline(const char *fname,
                                if (!strcmp(p, formats[i].id))
                                        break;
                        }
+                       if (!formats[i].id) {
+                               sprintf(err_msg, "Doesn't know how to handle delimiter '%s'",
+                                       p);
+                               goto error;
+                       }
                } else {
                        /* Seek for the delivery system */
                        for (i = 0; formats[i].delsys != 0; i++) {
                                if (formats[i].delsys == delsys)
                                        break;
                        }
+                       if (!formats[i].delsys) {
+                               sprintf(err_msg, "Doesn't know how to parse delivery system %d",
+                                       delsys);
+                               goto error;
+                       }
                }
-               if (i == ARRAY_SIZE(formats))
-                       goto error;
 
 
                fmt = &formats[i];