]> git.meshlink.io Git - meshlink/blobdiff - src/tincctl.c
Remove pidfile/logfile/netname and so on.
[meshlink] / src / tincctl.c
index fdb72e05469e4634b5ee411ce99e5b71e24a0520..a706f4846625caf2f3f58f789b54671d067a7946 100644 (file)
 #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);