X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Ftincctl.c;h=a706f4846625caf2f3f58f789b54671d067a7946;hb=2c9e02be099753999a3eab55bd2fed4ab4470f2b;hp=fdb72e05469e4634b5ee411ce99e5b71e24a0520;hpb=44c7f554c7a6eb411428cfd30ca2cb21a613830e;p=meshlink diff --git a/src/tincctl.c b/src/tincctl.c index fdb72e05..a706f484 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -33,12 +33,15 @@ #include "ecdsagen.h" #include "info.h" #include "invitation.h" -#include "names.h" #include "rsagen.h" #include "utils.h" #include "tincctl.h" #include "top.h" +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + static char **orig_argv; static int orig_argc; @@ -529,7 +532,7 @@ bool sendline(int fd, char *format, ...) { blen++; while(blen) { - int result = send(fd, p, blen, 0); + int result = send(fd, p, blen, MSG_NOSIGNAL); if(result == -1 && errno == EINTR) continue; else if(result <= 0) @@ -741,6 +744,11 @@ bool connect_tincd(bool verbose) { freeaddrinfo(res); #endif +#ifdef SO_NOSIGPIPE + static const int one = 1; + setsockopt(c, SOL_SOCKET, SO_NOSIGPIPE, (void *)&one, sizeof one); +#endif + char data[4096]; int version; @@ -2089,7 +2097,6 @@ static int switch_network(char *name) { free(netname); netname = strcmp(name, ".") ? xstrdup(name) : NULL; - make_names(); xasprintf(&tinc_conf, "%s" SLASH "tinc.conf", confbase); xasprintf(&hosts_dir, "%s" SLASH "hosts", confbase); xasprintf(&prompt, "%s> ", identname); @@ -2405,7 +2412,6 @@ int main(int argc, char *argv[]) { if(!parse_options(argc, argv)) return 1; - make_names(); xasprintf(&tinc_conf, "%s" SLASH "tinc.conf", confbase); xasprintf(&hosts_dir, "%s" SLASH "hosts", confbase);