From 1ddd00433ee4eb60818e8bd587d6f3ccfec70b8f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 17 Feb 2014 21:59:41 +0100 Subject: [PATCH] db/Configured: disallow both "db_file" and "database" This is misconfiguration, and MPD should abort. --- src/db/Configured.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/db/Configured.cxx b/src/db/Configured.cxx index 0cec7efd0..a6194dc5c 100644 --- a/src/db/Configured.cxx +++ b/src/db/Configured.cxx @@ -23,6 +23,7 @@ #include "config/ConfigGlobal.hxx" #include "config/ConfigData.hxx" #include "config/ConfigError.hxx" +#include "util/Error.hxx" #include "Log.hxx" Database * @@ -32,9 +33,12 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener, const struct config_param *param = config_get_param(CONF_DATABASE); const struct config_param *path = config_get_param(CONF_DB_FILE); - if (param != nullptr && path != nullptr) - LogWarning(config_domain, - "Found both 'database' and 'db_file' setting - ignoring the latter"); + if (param != nullptr && path != nullptr) { + error.Format(config_domain, + "Found both 'database' (line %d) and 'db_file' (line %d) setting", + param->line, path->line); + return nullptr; + } if (!have_storage) { if (param != nullptr)