summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2011-10-04 23:41:41 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2011-10-04 23:41:41 +0100
commit5be586e3025e72c1a1cef2a3ada6238486f7ed43 (patch)
tree2a5da19b632e9296e622e47c161062caec0b9b89 /src/xine-engine
parentd7c4d2bd622b1405ff520006dbeaf739e9725a89 (diff)
parent7e335173083e1fc91f27927a2d749f5a09773b32 (diff)
downloadxine-lib-5be586e3025e72c1a1cef2a3ada6238486f7ed43.tar.gz
xine-lib-5be586e3025e72c1a1cef2a3ada6238486f7ed43.tar.bz2
Merge from 1.1.
--HG-- rename : src/xine-utils/attributes.h => include/xine/attributes.h rename : src/xine-engine/xine_internal.h => include/xine/xine_internal.h rename : src/xine-utils/xineutils.h => include/xine/xineutils.h
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/Makefile.am2
-rw-r--r--src/xine-engine/broadcaster.c4
-rw-r--r--src/xine-engine/io_helper.c4
-rw-r--r--src/xine-engine/xine_private.h7
4 files changed, 13 insertions, 4 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index a0131a5e5..df35a7da4 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -20,7 +20,7 @@ else
DEF_FILE =
endif
-noinst_HEADERS = bswap.h ffmpeg_bswap.h
+noinst_HEADERS = bswap.h ffmpeg_bswap.h xine_private.h
lib_LTLIBRARIES = libxine.la
diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c
index f5ac0156f..00b38beb3 100644
--- a/src/xine-engine/broadcaster.c
+++ b/src/xine-engine/broadcaster.c
@@ -228,6 +228,8 @@ static void *manager_loop (void *this_gen) {
ssock = accept(this->msock, &(fsin.sa), &alen);
if (ssock >= 0) {
+ _x_set_socket_close_on_exec(ssock);
+
/* identification string, helps demuxer probing */
if( sock_string_write(this->stream->xine, ssock,"master xine v1") > 0 ) {
int *psock = malloc(sizeof(int));
@@ -308,7 +310,7 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port)
} servAddr;
int msock, err;
- msock = socket(PF_INET, SOCK_STREAM, 0);
+ msock = xine_socket_cloexec(PF_INET, SOCK_STREAM, 0);
if( msock < 0 )
{
xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: error opening master socket.\n");
diff --git a/src/xine-engine/io_helper.c b/src/xine-engine/io_helper.c
index d331b675a..399cb25a4 100644
--- a/src/xine-engine/io_helper.c
+++ b/src/xine-engine/io_helper.c
@@ -60,7 +60,7 @@ static int _x_io_tcp_connect_ipv4(xine_stream_t *stream, const char *host, int p
return -1;
}
- s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+ s = xine_socket_cloexec(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s == -1) {
_x_message(stream, XINE_MSG_CONNECTION_REFUSED, "failed to create socket", strerror(errno), NULL);
return -1;
@@ -144,7 +144,7 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) {
while (tmpaddr) {
- s = socket(tmpaddr->ai_family, SOCK_STREAM, IPPROTO_TCP);
+ s = xine_socket_cloexec(tmpaddr->ai_family, SOCK_STREAM, IPPROTO_TCP);
if (s == -1) {
_x_message(stream, XINE_MSG_CONNECTION_REFUSED,
"failed to create socket", strerror(errno), NULL);
diff --git a/src/xine-engine/xine_private.h b/src/xine-engine/xine_private.h
index 6c01d3a2d..a4c2a1d4f 100644
--- a/src/xine-engine/xine_private.h
+++ b/src/xine-engine/xine_private.h
@@ -94,4 +94,11 @@ void _x_audio_decoder_shutdown (xine_stream_t *stream) INTERNAL;
*/
void xine_probe_fast_memcpy(xine_t *xine) INTERNAL;
+/**
+ * @brief make file descriptors and sockets uninheritable
+ */
+int _x_set_file_close_on_exec(int fd) XINE_INTERNAL;
+
+int _x_set_socket_close_on_exec(int s) XINE_INTERNAL;
+
#endif