projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handle a disconnecting tincd better.
[tinc]
/
src
/
tincctl.c
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
fdb72e0
..
81e7a7a
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-39,6
+39,10
@@
#include "tincctl.h"
#include "top.h"
#include "tincctl.h"
#include "top.h"
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
+
static char **orig_argv;
static int orig_argc;
static char **orig_argv;
static int orig_argc;
@@
-529,7
+533,7
@@
bool sendline(int fd, char *format, ...) {
blen++;
while(blen) {
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)
if(result == -1 && errno == EINTR)
continue;
else if(result <= 0)
@@
-741,6
+745,11
@@
bool connect_tincd(bool verbose) {
freeaddrinfo(res);
#endif
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;
char data[4096];
int version;