]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3459] The server now checks if the configuration file was specified.
authorMarcin Siodelski <marcin@isc.org>
Thu, 24 Jul 2014 15:26:00 +0000 (17:26 +0200)
committerMarcin Siodelski <marcin@isc.org>
Thu, 24 Jul 2014 15:26:00 +0000 (17:26 +0200)
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.

src/bin/dhcp4/kea_controller.cc
src/bin/dhcp4/main.cc
src/bin/dhcp6/kea_controller.cc
src/bin/dhcp6/main.cc

index 017bad5f72bdc300486a7dba46c12a0d6e73f3ab..4ef51a6976c84c0c2cdee6809b9bb24df0deabf4 100644 (file)
@@ -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);
index fe259f5f06d344469accdd500d720c4c03449285..592bf342e01e545705237ae21687e5fb345d0b65 100644 (file)
@@ -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 {
index c70cf3bf60c63bd1c1cfa8d4a2ead347886e5628..0fafe21cfe6747327fdc6055ad482a498d041a09 100644 (file)
@@ -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);
index 6de1205d6aba68294d2652afc161f96bb565f745..f491ee04be858f327ee428df88cf70c3eea0056c 100644 (file)
@@ -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 {