From: Jaroslav Kysela Date: Thu, 10 Mar 2016 08:00:46 +0000 (+0100) Subject: scanfile: fix the initialization when muxconf_path is not set, fixes #3619 X-Git-Tag: v4.2.1~911 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c26169f3a5d50c846c2a5a960e0b011733fce68;p=thirdparty%2Ftvheadend.git scanfile: fix the initialization when muxconf_path is not set, fixes #3619 --- diff --git a/src/config.c b/src/config.c index 99408c3d9..a4395998c 100644 --- a/src/config.c +++ b/src/config.c @@ -48,6 +48,7 @@ #define IPTOS_CLASS_CS7 0xe0 #endif +static void config_muxconfpath_notify ( void *o, const char *lang ); void tvh_str_set(char **strp, const char *src); int tvh_str_update(char **strp, const char *src); @@ -59,6 +60,7 @@ int tvh_str_update(char **strp, const char *src); struct config config; static char config_lock[PATH_MAX]; static int config_lock_fd; +static int config_scanfile_ok; /* ************************************************************************* * Config migration @@ -1634,6 +1636,7 @@ config_boot ( const char *path, gid_t gid, uid_t uid ) config.dscp = -1; config.descrambler_buffer = 9000; config.epg_compress = 1; + config_scanfile_ok = 0; /* Generate default */ if (!path) { @@ -1704,6 +1707,8 @@ config_boot ( const char *path, gid_t gid, uid_t uid ) htsmsg_destroy(config2); if (config.server_name == NULL || config.server_name[0] == '\0') config.server_name = strdup("Tvheadend"); + if (!config_scanfile_ok) + config_muxconfpath_notify(&config.idnode, NULL); } void @@ -1936,7 +1941,7 @@ static void config_muxconfpath_notify_cb(void *opaque, int disarmed) { char *muxconf_path = opaque; - if (disarmed || muxconf_path == NULL || muxconf_path[0] == '\0') { + if (disarmed) { free(muxconf_path); return; } @@ -1950,7 +1955,9 @@ static void config_muxconfpath_notify ( void *o, const char *lang ) { #if ENABLE_MPEGTS_DVB - tasklet_arm_alloc(config_muxconfpath_notify_cb, strdup(config.muxconf_path)); + config_scanfile_ok = 1; + tasklet_arm_alloc(config_muxconfpath_notify_cb, + config.muxconf_path ? strdup(config.muxconf_path) : NULL); #endif }