Commit 07228dd9 authored by Marcin Siodelski's avatar Marcin Siodelski

[3459] The server now checks if the configuration file was specified.

When the configuration file hasn't been specified the server will print
an error message to the stderr and usage. Also I removed the spurious
parens from one of the error messages.
parent acdbb45c
......@@ -100,7 +100,7 @@ void configure(const std::string& file_name) {
if (rcode != 0) {
string reason = "";
if (comment) {
reason = string(" (") + comment->stringValue() + string(")");
reason = comment->stringValue();
}
LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_LOAD_FAIL).arg(reason);
isc_throw(isc::BadValue, "Failed to apply configuration: " << reason);
......
......@@ -97,6 +97,12 @@ main(int argc, char* argv[]) {
usage();
}
// Configuration file is required.
if (config_file.empty()) {
cerr << "Configuration file not specified." << endl;
usage();
}
int ret = EXIT_SUCCESS;
try {
......
......@@ -103,7 +103,7 @@ void configure(const std::string& file_name) {
if (rcode != 0) {
string reason = "";
if (comment) {
reason = string(" (") + comment->stringValue() + string(")");
reason = comment->stringValue();
}
LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_LOAD_FAIL).arg(reason);
isc_throw(isc::BadValue, "Failed to apply configuration:" << reason);
......
......@@ -97,6 +97,12 @@ main(int argc, char* argv[]) {
usage();
}
// Configuration file is required.
if (config_file.empty()) {
cerr << "Configuration file not specified." << endl;
usage();
}
int ret = EXIT_SUCCESS;
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment