X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincd.c;h=1c9b6ed6d04535ad7d440b0e3aa6169f8d9f92d1;hb=9235256116574927657a93944ef1b21e255e771b;hp=539f527473e96da11bdb7a58dfc742ca77dc6620;hpb=4436af55e55e79b496264fe114039fbc1198d71f;p=tinc diff --git a/src/tincd.c b/src/tincd.c index 539f5274..1c9b6ed6 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -56,6 +56,8 @@ #include "version.h" #include "random.h" #include "sandbox.h" +#include "watchdog.h" +#include "fs.h" /* If nonzero, display usage information and exit. */ static bool show_help = false; @@ -185,6 +187,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 +219,7 @@ static bool parse_options(int argc, char **argv) { break; case OPT_NETNAME: + assert(optarg); free(netname); netname = xstrdup(optarg); break; @@ -280,6 +284,7 @@ static bool parse_options(int argc, char **argv) { break; case OPT_PIDFILE: + assert(optarg); free(pidfilename); pidfilename = get_path_arg(optarg); break; @@ -411,7 +416,9 @@ static bool drop_privs(void) { return false; } -#endif +#endif // HAVE_WINDOWS + + makedirs(DIR_CACHE | DIR_HOSTS | DIR_INVITATIONS); return sandbox_enter(); } @@ -691,8 +698,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: