]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvbcam: Fixed saving of a cleared dvbcam caid_list (from WEB UI)
authorJasmin Jessich <jasmin@anw.at>
Thu, 23 Nov 2017 21:53:34 +0000 (22:53 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 24 Nov 2017 07:18:43 +0000 (08:18 +0100)
caclient_dvbcam_class_caid_list_set didn't count the existing entries in the
dvbcam caid_list. Thus, it couldn't check if the old and the new list size
differ. This was only a problem when the list was cleared, because the
change flag was not set in this case and the empty list was not saved.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
src/descrambler/dvbcam.c

index 4de5ad66055f7a996fe6f4db1c60e77da5c90b8e..d483369a8c986c939927ce568659a73eddb81fad 100644 (file)
@@ -737,9 +737,10 @@ caclient_dvbcam_class_caid_list_set( void *obj, const void *p )
   const char *s;
   htsmsg_field_t *f;
   uint16_t caid_list[ARRAY_SIZE(dc->caid_list)];
-  int caid, index = 0, change = 0;
+  int caid, idx, index = 0, change = 0;
+
+  for (idx = 0; dc->caid_list[idx] && idx < ARRAY_SIZE(dc->caid_list); idx++);
 
-  dc->caid_list[0] = 0;
   if (list == NULL)
     return 0;
   HTSMSG_FOREACH(f, list) {
@@ -762,7 +763,7 @@ caclient_dvbcam_class_caid_list_set( void *obj, const void *p )
     dc->caid_list[index] = 0;
   if (change)
     memcpy(dc->caid_list, caid_list, index * sizeof(caid_list[0]));
-  return change;
+  return change || index != idx;
 }
 
 static const void *