#include "sandbox.h"
#include "pidfile.h"
#include "console.h"
+#include "fs.h"
#ifndef MSG_NOSIGNAL
#define MSG_NOSIGNAL 0
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");
if(first) {
first = false;
} else {
- printf("#---------------------------------------------------------------#\n");
+ printf("\n#---------------------------------------------------------------#\n");
}
result |= export(ent->d_name, stdout);