diff options
Diffstat (limited to 'src/xine-engine')
| -rw-r--r-- | src/xine-engine/Makefile.am | 2 | ||||
| -rw-r--r-- | src/xine-engine/broadcaster.c | 4 | ||||
| -rw-r--r-- | src/xine-engine/io_helper.c | 4 | ||||
| -rw-r--r-- | src/xine-engine/xine_private.h | 7 |
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 |
