Extract filesystem-related functions into fs.c
[tinc] / src / tincd.c
index 20d0e29..1c9b6ed 100644 (file)
@@ -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;
@@ -414,7 +416,9 @@ static bool drop_privs(void) {
                        return false;
                }
 
-#endif
+#endif // HAVE_WINDOWS
+
+       makedirs(DIR_CACHE | DIR_HOSTS | DIR_INVITATIONS);
 
        return sandbox_enter();
 }
@@ -694,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: