#include "sandbox.h"
#include "pidfile.h"
#include "console.h"
+#include "fs.h"
#ifndef MSG_NOSIGNAL
#define MSG_NOSIGNAL 0
static char *prompt;
char *device = NULL;
char *iface = NULL;
-int debug_level = -1;
+debug_t debug_level = -1;
typedef enum option_t {
OPT_BAD_OPTION = '?',
}
while(!(newline = memchr(buffer, '\n', blen))) {
+ if(!wait_socket_recv(fd)) {
+ return false;
+ }
+
ssize_t nrecv = recv(fd, buffer + blen, sizeof(buffer) - blen, 0);
if(nrecv == -1 && sockerrno == EINTR) {
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);