Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
config: fix the global config variable initialization on error, fixes…
… #2816
  • Loading branch information
perexg committed May 3, 2015
1 parent fff2c36 commit b609513
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/config.c
Expand Up @@ -1395,6 +1395,9 @@ config_boot ( const char *path, gid_t gid, uid_t uid )
{
struct stat st;
char buf[1024];
htsmsg_t *config2;

config = htsmsg_create_map();

/* Generate default */
if (!path) {
Expand Down Expand Up @@ -1438,10 +1441,12 @@ config_boot ( const char *path, gid_t gid, uid_t uid )
tvhwarn("config", "unable to chown lock file %s UID:%d GID:%d", config_lock, uid, gid);

/* Load global settings */
config = hts_settings_load("config");
if (!config) {
config2 = hts_settings_load("config");
if (!config2) {
tvhlog(LOG_DEBUG, "config", "no configuration, loading defaults");
config = htsmsg_create_map();
} else {
htsmsg_destroy(config);
config = config2;
}
}

Expand Down

0 comments on commit b609513

Please sign in to comment.