diff options
| author | Chris Rankin <rankincj@yahoo.com> | 2011-10-03 21:07:39 +0100 |
|---|---|---|
| committer | Chris Rankin <rankincj@yahoo.com> | 2011-10-03 21:07:39 +0100 |
| commit | fa660f82ae5889b931c645133abb151f26fba343 (patch) | |
| tree | 1da8b888711c6afcf209d54f67e1c3ac43d9da9b /src/xine-engine | |
| parent | 5db268a002e7a102855e84a3ff5e1c27ca7cb927 (diff) | |
| download | xine-lib-fa660f82ae5889b931c645133abb151f26fba343.tar.gz xine-lib-fa660f82ae5889b931c645133abb151f26fba343.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 have been assigned "internal" visibility so
that they can be used throughout libxine.so itself while still
not being exported to the global symbol table. In other words,
they're both as close to being "static" as I can make them.
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/xine_internal.h | 1 | ||||
| -rw-r--r-- | src/xine-engine/xine_private.h | 39 |
4 files changed, 44 insertions, 2 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index 576c61b14..67ae63fae 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -41,7 +41,7 @@ xineinclude_HEADERS = buffer.h metronom.h configfile.h vo_scale.h \ plugin_catalog.h audio_decoder.h video_decoder.h post.h \ io_helper.h broadcaster.h info_helper.h refcounter.h alphablend.h -noinst_HEADERS = bswap.h ffmpeg_bswap.h +noinst_HEADERS = bswap.h ffmpeg_bswap.h xine_private.h if WIN32 install-exec-local: diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index a554337a3..3f943171f 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -227,6 +227,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)); @@ -307,7 +309,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_internal.h b/src/xine-engine/xine_internal.h index 7566c83e0..bb2113831 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -48,6 +48,7 @@ extern "C" { # include "io_helper.h" # include "info_helper.h" # include "alphablend.h" +# include "xine_private.h" #else # include <xine.h> # include <xine/refcounter.h> diff --git a/src/xine-engine/xine_private.h b/src/xine-engine/xine_private.h new file mode 100644 index 000000000..1f3564cbc --- /dev/null +++ b/src/xine-engine/xine_private.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2000-2011 the xine project + * + * This file is part of xine, a free video player. + * + * xine is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * xine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + */ + +#ifndef HAVE_XINE_PRIVATE_H +#define HAVE_XINE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 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; + +#ifdef __cplusplus +} +#endif + +#endif |
