diff --git a/src/core/config.c b/src/core/config.c index 8a2ab99b8..e904660ec 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -1797,7 +1797,9 @@ int load_config(config_t *config) { // Apply environment variable overrides // This allows LIGHTNVR_ prefixed env vars to set config values // that are not already set in the config file (useful for container deployments) + pthread_mutex_lock(&mp4_faststart_mutex); apply_env_overrides(config, ini_present); + pthread_mutex_unlock(&mp4_faststart_mutex); // Set default web root if not specified if (strlen(config->web_root) == 0) { @@ -1962,6 +1964,7 @@ int save_config(const config_t *config, const char *path) { {"syslog_ident", config->syslog_ident, sizeof(config->syslog_ident)}, {"storage_path", config->storage_path, sizeof(config->storage_path)}, {"api_detection_url", config->api_detection_url, sizeof(config->api_detection_url)}, + {"go2rtc_config_dir", config->go2rtc_config_dir, sizeof(config->go2rtc_config_dir)}, }; for (size_t i = 0; i < sizeof(validated_fields) / sizeof(validated_fields[0]); ++i) { diff --git a/tests/unit/test_config.c b/tests/unit/test_config.c index 72fc9e587..4d2c02e48 100644 --- a/tests/unit/test_config.c +++ b/tests/unit/test_config.c @@ -1471,6 +1471,9 @@ static void test_save_config_rejects_unsafe_credentials_before_writing(void) { snprintf(cfg.pid_file, sizeof(cfg.pid_file), "/tmp/lightnvr.pid"); snprintf(cfg.api_detection_url, sizeof(cfg.api_detection_url), "http://example/#bad"); TEST_ASSERT_EQUAL_INT(-1, save_config(&cfg, path)); + cfg.api_detection_url[0] = '\0'; + snprintf(cfg.go2rtc_config_dir, sizeof(cfg.go2rtc_config_dir), "/etc/lightnvr\n[web]"); + TEST_ASSERT_EQUAL_INT(-1, save_config(&cfg, path)); char content[64] = {0}; FILE *saved = fopen(path, "r");