Add tests for some device & address variables
[tinc] / src / tincd.c
index 8a4c1f3..4c33dc0 100644 (file)
@@ -57,6 +57,7 @@
 #include "random.h"
 #include "sandbox.h"
 #include "watchdog.h"
+#include "fs.h"
 
 /* If nonzero, display usage information and exit. */
 static bool show_help = false;
@@ -415,7 +416,9 @@ static bool drop_privs(void) {
                        return false;
                }
 
-#endif
+#endif // HAVE_WINDOWS
+
+       makedirs(DIR_CACHE | DIR_HOSTS | DIR_INVITATIONS);
 
        return sandbox_enter();
 }
@@ -500,6 +503,9 @@ int main(int argc, char **argv) {
 #endif
 #ifdef ENABLE_VDE
                        " vde"
+#endif
+#ifdef HAVE_WATCHDOG
+                       " watchdog"
 #endif
                        "\n\n"
                        "Copyright (C) 1998-2021 Ivo Timmermans, Guus Sliepen and others.\n"
@@ -560,7 +566,9 @@ int main(int argc, char **argv) {
 
        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;
        }