From: Jasmin Jessich Date: Thu, 23 Nov 2017 21:53:34 +0000 (+0100) Subject: dvbcam: Fixed saving of a cleared dvbcam caid_list (from WEB UI) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a83c1559d852ab2711ea78a0551d656d7bf5c660;p=thirdparty%2Ftvheadend.git dvbcam: Fixed saving of a cleared dvbcam caid_list (from WEB UI) 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 --- diff --git a/src/descrambler/dvbcam.c b/src/descrambler/dvbcam.c index 4de5ad660..d483369a8 100644 --- a/src/descrambler/dvbcam.c +++ b/src/descrambler/dvbcam.c @@ -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 *