File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -409,9 +409,15 @@ void run_broker(boost::program_options::variables_map const& vm) {
409
409
410
410
std::ifstream input (auth_file);
411
411
412
- MQTT_NS::broker::security security;
413
- security.load_json (input);
414
- b.set_security (MQTT_NS::force_move (security));
412
+ if (input) {
413
+ MQTT_NS::broker::security security;
414
+ security.load_json (input);
415
+ b.set_security (MQTT_NS::force_move (security));
416
+ } else
417
+ {
418
+ MQTT_LOG (" mqtt_broker" , error)
419
+ << " Authorization file '" << auth_file << " ' not found, broker doesn't use authorization file." << std::endl;
420
+ }
415
421
}
416
422
}
417
423
@@ -651,7 +657,7 @@ int main(int argc, char **argv) {
651
657
std::string config_file = vm[" cfg" ].as <std::string>();
652
658
if (!config_file.empty ()) {
653
659
std::ifstream input (vm[" cfg" ].as <std::string>());
654
- if (input. good () ) {
660
+ if (input) {
655
661
boost::program_options::store (boost::program_options::parse_config_file (input, desc), vm);
656
662
} else
657
663
{
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ BOOST_AUTO_TEST_CASE(json_comments) {
29
29
BOOST_CHECK (json_remove_comments (" \" #test\" " ) == " \" #test\" " );
30
30
BOOST_CHECK (json_remove_comments (" \" '#test'\" " ) == " \" '#test'\" " );
31
31
BOOST_CHECK (json_remove_comments (" '\" #test\" '" ) == " '\" #test\" '" );
32
+ BOOST_CHECK (json_remove_comments (" " ) == " " );
32
33
}
33
34
34
35
BOOST_AUTO_TEST_CASE (default_config) {
You can’t perform that action at this time.
0 commit comments