summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main.cpp b/src/main.cpp
index ed05d36..422219a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,22 +3,15 @@
#include <network/poller.hpp>
#include <config/config.hpp>
#include <logger/logger.hpp>
-#include <utils/reload.hpp>
#include <utils/xdg.hpp>
-
-#include <iostream>
-#include <memory>
-#include <atomic>
-
-#include <signal.h>
+#include <utils/reload.hpp>
#ifdef CARES_FOUND
# include <network/dns_handler.hpp>
#endif
-#ifdef SYSTEMD_FOUND
-# include <systemd/sd-daemon.h>
-#endif
+#include <atomic>
+#include <signal.h>
// A flag set by the SIGINT signal handler.
static volatile std::atomic<bool> stop(false);
@@ -71,6 +64,12 @@ int main(int ac, char** av)
if (hostname.empty())
return config_help("hostname");
+ try {
+ open_database();
+ } catch (...) {
+ return 1;
+ }
+
// Block the signals we want to manage. They will be unblocked only during
// the epoll_pwait or ppoll calls. This avoids some race conditions,
// explained in man 2 pselect on linux