Split event.c into per-API files
[tinc] / src / tincd.c
index 539f527..8a4c1f3 100644 (file)
@@ -56,6 +56,7 @@
 #include "version.h"
 #include "random.h"
 #include "sandbox.h"
+#include "watchdog.h"
 
 /* If nonzero, display usage information and exit. */
 static bool show_help = false;
@@ -185,6 +186,7 @@ static bool parse_options(int argc, char **argv) {
                        goto exit_fail;
 
                case OPT_CONFIG_FILE:
+                       assert(optarg);
                        free(confbase);
                        confbase = get_path_arg(optarg);
                        break;
@@ -216,6 +218,7 @@ static bool parse_options(int argc, char **argv) {
                        break;
 
                case OPT_NETNAME:
+                       assert(optarg);
                        free(netname);
                        netname = xstrdup(optarg);
                        break;
@@ -280,6 +283,7 @@ static bool parse_options(int argc, char **argv) {
                        break;
 
                case OPT_PIDFILE:
+                       assert(optarg);
                        free(pidfilename);
                        pidfilename = get_path_arg(optarg);
                        break;
@@ -691,8 +695,16 @@ int main2(int argc, char **argv) {
 
        try_outgoing_connections();
 
+#ifdef HAVE_WATCHDOG
+       watchdog_start();
+#endif
+
        status = main_loop();
 
+#ifdef HAVE_WATCHDOG
+       watchdog_stop();
+#endif
+
        /* Shutdown properly. */
 
 end: