summaryrefslogtreecommitdiffstats
path: root/src/bin/lfc
diff options
context:
space:
mode:
authorRazvan Becheriu <razvan@isc.org>2021-05-31 11:54:58 +0200
committerRazvan Becheriu <razvan@isc.org>2021-06-09 18:38:55 +0200
commit6ecf1f78580a9e2f47c2b1a789861db3d4ec5f6e (patch)
tree8d379418f8a7a387634eb7969ea75d85947d9cfe /src/bin/lfc
parent[#1921] hammer: fixed building on alpine, ubuntu, debian and freebsd (diff)
downloadkea-6ecf1f78580a9e2f47c2b1a789861db3d4ec5f6e.tar.xz
kea-6ecf1f78580a9e2f47c2b1a789861db3d4ec5f6e.zip
[#1907] catch all exceptions in main functions
Diffstat (limited to 'src/bin/lfc')
-rw-r--r--src/bin/lfc/main.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/bin/lfc/main.cc b/src/bin/lfc/main.cc
index 36023428c7..e0cd2681f3 100644
--- a/src/bin/lfc/main.cc
+++ b/src/bin/lfc/main.cc
@@ -24,19 +24,20 @@ using namespace isc::lfc;
/// The exit value of the program will be EXIT_SUCCESS if there were no
/// errors, EXIT_FAILURE otherwise.
int main(int argc, char* argv[]) {
- // Ask scheduling to not give too much resources to LFC.
- // First parameter means to change only the process priority.
- // Second parameter (0) means the calling process.
- // Third parameter 4 is a bit below the default priority of 0 in
- // a range of -20 (highest priority) and 19 or 20 (lowest priority).
- static_cast<void>(setpriority(PRIO_PROCESS, 0, 4));
-
int ret = EXIT_SUCCESS;
- LFCController lfc_controller;
+ try {
+ // Ask scheduling to not give too much resources to LFC.
+ // First parameter means to change only the process priority.
+ // Second parameter (0) means the calling process.
+ // Third parameter 4 is a bit below the default priority of 0 in
+ // a range of -20 (highest priority) and 19 or 20 (lowest priority).
+ static_cast<void>(setpriority(PRIO_PROCESS, 0, 4));
+
+ LFCController lfc_controller;
+
+ // Launch the controller passing in command line arguments.
+ // Exit program with the controller's return code.
- // Launch the controller passing in command line arguments.
- // Exit program with the controller's return code.
- try {
// 'false' value disables test mode.
lfc_controller.launch(argc, argv, false);
@@ -47,6 +48,8 @@ int main(int argc, char* argv[]) {
} catch (const std::exception& ex) {
std::cerr << "Service failed: " << ex.what() << std::endl;
ret = EXIT_FAILURE;
+ } catch (...) {
+ ret = EXIT_FAILURE;
}
return (ret);