[vlc-devel] [PATCH] tls: Fix build without netinet/tcp.h
Julian Scheel
julian at jusst.de
Fri Mar 10 11:14:29 CET 2017
It's not enough to define SOL_TCP if netinet/tcp.h is not available. As
there is not toolchain agnostic value we could use to replace
TCP_NODELAY do only call setsockopt if netinet/tcp.h is available.
Signed-off-by: Julian Scheel <julian at jusst.de>
---
src/network/tls.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/network/tls.c b/src/network/tls.c
index 3210cfe865..e76e59ca22 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -42,9 +42,6 @@
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
-#ifndef SOL_TCP
-# define SOL_TCP IPPROTO_TCP
-#endif
#include <vlc_common.h>
#include "libvlc.h"
@@ -440,8 +437,10 @@ static vlc_tls_t *vlc_tls_SocketAddrInfo(const struct addrinfo *restrict info)
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof (int));
+#ifdef HAVE_NETINET_TCP_H
if (info->ai_socktype == SOCK_STREAM && info->ai_protocol == IPPROTO_TCP)
setsockopt(fd, SOL_TCP, TCP_NODELAY, &(int){ 1 }, sizeof (int));
+#endif
vlc_tls_t *sk = vlc_tls_SocketAlloc(fd, info->ai_addr, info->ai_addrlen);
if (unlikely(sk == NULL))
--
2.12.0
More information about the vlc-devel
mailing list