X-Git-Url: http://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=2ed286a62d95881ede05da7ddd97e0c7dd7433f7;hb=ad2e8db4730e3c4355db2cea911422e7efd6a1ee;hp=5144b793265e08ebde34af6975d691b733238f30;hpb=c5373d9fc0c8e3dfb6529b35bf44efe58410e0c7;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 5144b793..2ed286a6 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -44,6 +44,7 @@ #include "sandbox.h" #include "pidfile.h" #include "console.h" +#include "fs.h" #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 @@ -2234,19 +2235,8 @@ static int cmd_init(int argc, char *argv[]) { return 1; } - if(!confbase_given && mkdir(confdir, 0755) && errno != EEXIST) { - fprintf(stderr, "Could not create directory %s: %s\n", confdir, strerror(errno)); - return 1; - } - - if(mkdir(confbase, 0777) && errno != EEXIST) { - fprintf(stderr, "Could not create directory %s: %s\n", confbase, strerror(errno)); - return 1; - } - - if(mkdir(hosts_dir, 0777) && errno != EEXIST) { - fprintf(stderr, "Could not create directory %s: %s\n", hosts_dir, strerror(errno)); - return 1; + if(!makedirs(DIR_HOSTS | DIR_CONFBASE | DIR_CONFDIR | DIR_CACHE)) { + return false; } FILE *f = fopen(tinc_conf, "w"); @@ -2545,7 +2535,7 @@ static int cmd_export_all(int argc, char *argv[]) { if(first) { first = false; } else { - printf("#---------------------------------------------------------------#\n"); + printf("\n#---------------------------------------------------------------#\n"); } result |= export(ent->d_name, stdout);