diff options
author | Chris Rankin <rankincj@yahoo.com> | 2011-10-03 21:27:57 +0100 |
---|---|---|
committer | Chris Rankin <rankincj@yahoo.com> | 2011-10-03 21:27:57 +0100 |
commit | 7a585790118e837ec788ac9b3e4cf6a381c61234 (patch) | |
tree | 9d60c2cce1518d75c9b0bd1bc31e278e74cc7f3f /src/xine-engine | |
parent | a39a950269d165f18448cc7d6da691bf14b9e03b (diff) | |
download | xine-lib-7a585790118e837ec788ac9b3e4cf6a381c61234.tar.gz xine-lib-7a585790118e837ec788ac9b3e4cf6a381c61234.tar.bz2 |
Set CLOEXEC flag on three more sockets.
There are two functions that actually set this flag:
int _x_set_file_close_on_exec()
int _x_set_socket_close_on_exec()
(We need two functions because file descriptors and sockets
are not the same under WIN32 - of course).
These function belong to libxine's internal API, i.e. they are
not available for use by plugins.
Diffstat (limited to 'src/xine-engine')
-rw-r--r-- | src/xine-engine/broadcaster.c | 5 | ||||
-rw-r--r-- | src/xine-engine/xine_private.h | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index f5ac0156f..0c2f2d4b2 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -64,6 +64,7 @@ #include <xine/xine_internal.h> #include <xine/buffer.h> #include <xine/xineutils.h> +#include "xine_private.h" #define QLEN 5 /* maximum connection queue length */ #define _BUFSIZ 512 @@ -228,6 +229,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 +311,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/xine_private.h b/src/xine-engine/xine_private.h index 6c01d3a2d..a82f6a05f 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) INTERNAL; + +int _x_set_socket_close_on_exec(int s) INTERNAL; + #endif |