summaryrefslogtreecommitdiff
path: root/src/io.c
diff options
context:
space:
mode:
authorShawn Landden <shawn@git.icu>2018-07-25 21:16:29 -0700
committerShawn Landden <shawn@git.icu>2018-07-25 21:19:07 -0700
commit08c24d2d71bffed9c224a722f2958757a35545f2 (patch)
tree174d303f2da5857f57d9bd99198bf29c852e5302 /src/io.c
parentbd137d0cfb7b0517efe998a7b79d3318b471ccd6 (diff)
downloaddistcc-git-08c24d2d71bffed9c224a722f2958757a35545f2.tar.gz
test for sockets
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/io.c b/src/io.c
index 63ff587..df726e8 100644
--- a/src/io.c
+++ b/src/io.c
@@ -252,7 +252,6 @@ int dcc_writex(int fd, const void *buf, size_t len)
return 0;
}
-
/**
* Stick a TCP cork in the socket. It's not clear that this will help
* performance, but it might.
@@ -262,7 +261,8 @@ int dcc_writex(int fd, const void *buf, size_t len)
int tcp_cork_sock(int POSSIBLY_UNUSED(fd), int POSSIBLY_UNUSED(corked))
{
#if defined(TCP_CORK) && defined(SOL_TCP)
- if (!dcc_getenv_bool("DISTCC_TCP_CORK", 1))
+ if (!dcc_getenv_bool("DISTCC_TCP_CORK", 1) || !(sd_is_socket(fd, AF_INET, SOCK_STREAM, 1) ||
+ sd_is_socket(fd, AF_INET6, SOCK_STREAM, 1)))
return 0;
if (setsockopt(fd, SOL_TCP, TCP_CORK, &corked, sizeof corked) == -1) {
@@ -280,8 +280,6 @@ int tcp_cork_sock(int POSSIBLY_UNUSED(fd), int POSSIBLY_UNUSED(corked))
return 0;
}
-
-
int dcc_close(int fd)
{
if (close(fd) != 0) {