summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
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/xine_internal.h1
-rw-r--r--src/xine-engine/xine_private.h39
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