X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Ftincctl.c;fp=src%2Ftincctl.c;h=81e7a7a2cbdbcbd4f94835769379b22a37556413;hp=fdb72e05469e4634b5ee411ce99e5b71e24a0520;hb=f134bd0c9c2213fbbb3967f3d784759cb65e2c76;hpb=09e000ba54fd4a4ffe3e5c15ee7aeadac35d6996 diff --git a/src/tincctl.c b/src/tincctl.c index fdb72e05..81e7a7a2 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -39,6 +39,10 @@ #include "tincctl.h" #include "top.h" +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + static char **orig_argv; static int orig_argc; @@ -529,7 +533,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 +745,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;