#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;
goto exit_fail;
case OPT_CONFIG_FILE:
+ assert(optarg);
free(confbase);
confbase = get_path_arg(optarg);
break;
break;
case OPT_NETNAME:
+ assert(optarg);
free(netname);
netname = xstrdup(optarg);
break;
break;
case OPT_PIDFILE:
+ assert(optarg);
free(pidfilename);
pidfilename = get_path_arg(optarg);
break;
return false;
}
-#endif
+#endif // HAVE_WINDOWS
+
+ makedirs(DIR_CACHE | DIR_HOSTS | DIR_INVITATIONS);
return sandbox_enter();
}
#endif
#ifdef ENABLE_VDE
" vde"
+#endif
+#ifdef HAVE_WATCHDOG
+ " watchdog"
#endif
"\n\n"
"Copyright (C) 1998-2021 Ivo Timmermans, Guus Sliepen and others.\n"
g_argv = argv;
- if(getenv("LISTEN_PID") && atoi(getenv("LISTEN_PID")) == getpid()) {
+ const char *listen_pid = getenv("LISTEN_PID");
+
+ if(listen_pid && atoi(listen_pid) == getpid()) {
do_detach = false;
}
try_outgoing_connections();
+#ifdef HAVE_WATCHDOG
+ watchdog_start();
+#endif
+
status = main_loop();
+#ifdef HAVE_WATCHDOG
+ watchdog_stop();
+#endif
+
/* Shutdown properly. */
end: