summaryrefslogtreecommitdiff
path: root/src/input/input_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/input_net.c')
-rw-r--r--src/input/input_net.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/input/input_net.c b/src/input/input_net.c
index 5007b58a3..f44db8301 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -122,6 +122,18 @@ static int host_connect_attempt_ipv4(struct in_addr ia, int port, xine_t *xine)
return -1;
}
+#ifndef WIN32
+ if (fcntl(s, F_SETFD, FD_CLOEXEC) < 0) {
+ xine_log(xine, XINE_LOG_MSG,
+ _("input_net: Failed to make socket uninheritable (%s)\n"),
+ strerror(errno));
+ }
+#else
+ if (!SetHandleInformation((HANDLE)s, HANDLE_FLAG_INHERIT, 0)) {
+ xine_log(xine, XINE_LOG_MSG, "Failed to make socket uninheritable\n");
+ }
+#endif
+
sin.sin_family = AF_INET;
sin.sin_addr = ia;
sin.sin_port = htons(port);
@@ -153,6 +165,18 @@ static int host_connect_attempt(int family, struct sockaddr* sin, int addrlen, x
}
#ifndef WIN32
+ if (fcntl(s, F_SETFD, FD_CLOEXEC) < 0) {
+ xine_log(xine, XINE_LOG_MSG,
+ _("input_net: Failed to make socket uninheritable (%s)\n"),
+ strerror(errno));
+ }
+#else
+ if (!SetHandleInformation((HANDLE)s, HANDLE_FLAG_INHERIT, 0)) {
+ xine_log(xine, XINE_LOG_MSG, "Failed to make socket uninheritable\n");
+ }
+#endif
+
+#ifndef WIN32
if (connect(s, sin, addrlen)==-1 && errno != EINPROGRESS)
#else
if (connect(s, sin, addrlen)==-1 && WSAGetLastError() != WSAEINPROGRESS)