epggrab: ensure / in channel ID doesn't cause config failure. Fixes #1774.
This commit is contained in:
parent
0c039fc2f4
commit
a8ce127dee
1 changed files with 15 additions and 6 deletions
|
@ -16,9 +16,6 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "tvheadend.h"
|
#include "tvheadend.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "htsmsg.h"
|
#include "htsmsg.h"
|
||||||
|
@ -27,6 +24,9 @@
|
||||||
#include "epggrab.h"
|
#include "epggrab.h"
|
||||||
#include "epggrab/private.h"
|
#include "epggrab/private.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/* **************************************************************************
|
/* **************************************************************************
|
||||||
* EPG Grab Channel functions
|
* EPG Grab Channel functions
|
||||||
* *************************************************************************/
|
* *************************************************************************/
|
||||||
|
@ -187,10 +187,19 @@ epggrab_channel_t *epggrab_channel_find
|
||||||
( epggrab_channel_tree_t *tree, const char *id, int create, int *save,
|
( epggrab_channel_tree_t *tree, const char *id, int create, int *save,
|
||||||
epggrab_module_t *owner )
|
epggrab_module_t *owner )
|
||||||
{
|
{
|
||||||
|
char *s;
|
||||||
epggrab_channel_t *ec;
|
epggrab_channel_t *ec;
|
||||||
static epggrab_channel_t *skel = NULL;
|
static epggrab_channel_t *skel = NULL;
|
||||||
if (!skel) skel = calloc(1, sizeof(epggrab_channel_t));
|
if (!skel) skel = calloc(1, sizeof(epggrab_channel_t));
|
||||||
skel->id = (char*)id;
|
skel->id = strdupa(id);
|
||||||
|
|
||||||
|
/* Replace / with # */
|
||||||
|
// Note: this is a bit of a nasty fix for #1774, but will do for now
|
||||||
|
s = skel->id;
|
||||||
|
while (*s) {
|
||||||
|
if (*s == '/') *s = '#';
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
|
||||||
/* Find */
|
/* Find */
|
||||||
if (!create) {
|
if (!create) {
|
||||||
|
@ -202,9 +211,9 @@ epggrab_channel_t *epggrab_channel_find
|
||||||
if (!ec) {
|
if (!ec) {
|
||||||
assert(owner);
|
assert(owner);
|
||||||
ec = skel;
|
ec = skel;
|
||||||
skel = NULL;
|
ec->id = strdup(skel->id);
|
||||||
ec->id = strdup(id);
|
|
||||||
ec->mod = owner;
|
ec->mod = owner;
|
||||||
|
skel = NULL;
|
||||||
*save = 1;
|
*save = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue