summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Rankin <rankincj@yahoo.com>2011-10-03 01:48:45 +0100
committerChris Rankin <rankincj@yahoo.com>2011-10-03 01:48:45 +0100
commitcba782a23ee5c9c668e02f9c6d95acba70464d18 (patch)
tree248b5dd329225b3383a679a697804952e9536899 /src
parentbd482ac652db2a937381c475718139f1668de266 (diff)
downloadxine-lib-cba782a23ee5c9c668e02f9c6d95acba70464d18.tar.gz
xine-lib-cba782a23ee5c9c668e02f9c6d95acba70464d18.tar.bz2
Add CLOEXEC support for VDR plugin, plus a few extra descriptors.
Diffstat (limited to 'src')
-rw-r--r--src/audio_dec/xine_a52_decoder.c2
-rw-r--r--src/input/input_dvb.c2
-rw-r--r--src/vdr/input_vdr.c18
3 files changed, 16 insertions, 6 deletions
diff --git a/src/audio_dec/xine_a52_decoder.c b/src/audio_dec/xine_a52_decoder.c
index bb0169a21..683b4dd1e 100644
--- a/src/audio_dec/xine_a52_decoder.c
+++ b/src/audio_dec/xine_a52_decoder.c
@@ -783,7 +783,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre
this->a52_flags_map[i] |= A52_ADJUST_LEVEL;
*/
#ifdef DEBUG_A52
- a52file = open ("test.a52", O_CREAT | O_WRONLY | O_TRUNC, 0644);
+ a52file = create_cloexec("test.a52", O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
#endif
return &this->audio_decoder;
}
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index 3667fbe43..6a984ab14 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -638,7 +638,7 @@ static tuner_t *XINE_MALLOC tuner_init(xine_t * xine, int adapter)
if(this->feinfo.type==FE_OFDM) xprintf(this->xine,XINE_VERBOSITY_DEBUG,"TER Card\n");
if(this->feinfo.type==FE_ATSC) xprintf(this->xine,XINE_VERBOSITY_DEBUG,"US Card\n");
- if ((test_video=open(video_device, O_RDWR)) < 0) {
+ if ((test_video=open_cloexec(video_device, O_RDWR)) < 0) {
xprintf(this->xine,XINE_VERBOSITY_DEBUG,"input_dvb: Card has no hardware decoder\n");
}else{
xprintf(this->xine,XINE_VERBOSITY_DEBUG,"input_dvb: Card HAS HARDWARE DECODER\n");
diff --git a/src/vdr/input_vdr.c b/src/vdr/input_vdr.c
index ed478c80d..ac8c8c795 100644
--- a/src/vdr/input_vdr.c
+++ b/src/vdr/input_vdr.c
@@ -1919,7 +1919,7 @@ static int vdr_plugin_open_fifo_mrl(input_plugin_t *this_gen)
filename = strdup(filename);
_x_mrl_unescape (filename);
- this->fh = open(filename, O_RDONLY | O_NONBLOCK);
+ this->fh = open_cloexec(filename, O_RDONLY | O_NONBLOCK);
lprintf("filename '%s'\n", filename);
@@ -1960,7 +1960,7 @@ static int vdr_plugin_open_fifo_mrl(input_plugin_t *this_gen)
char *filename_control = 0;
asprintf(&filename_control, "%s.control", filename);
- this->fh_control = open(filename_control, O_RDONLY);
+ this->fh_control = open_cloexec(filename_control, O_RDONLY);
if (this->fh_control == -1) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
@@ -1980,7 +1980,7 @@ static int vdr_plugin_open_fifo_mrl(input_plugin_t *this_gen)
char *filename_result = 0;
asprintf(&filename_result, "%s.result", filename);
- this->fh_result = open(filename_result, O_WRONLY);
+ this->fh_result = open_cloexec(filename_result, O_WRONLY);
if (this->fh_result == -1) {
perror("failed");
@@ -2002,7 +2002,7 @@ static int vdr_plugin_open_fifo_mrl(input_plugin_t *this_gen)
char *filename_event = 0;
asprintf(&filename_event, "%s.event", filename);
- this->fh_event = open(filename_event, O_WRONLY);
+ this->fh_event = open_cloexec(filename_event, O_WRONLY);
if (this->fh_event == -1) {
perror("failed");
@@ -2038,6 +2038,16 @@ static int vdr_plugin_open_socket(vdr_input_plugin_t *this, struct hostent *host
return -1;
}
+#ifndef WIN32
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) {
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Failed to make socket uninheritable (%s)\n", strerror(errno));
+ }
+#else
+ if (!SetHandleInformation((HANDLE)fd, HANDLE_FLAG_INHERIT, 0)) {
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Failed to make socket uninheritable\n");
+ }
+#endif
+
iaddr.s_addr = *((unsigned int *)host->h_addr_list[0]);
sain.sin_port = htons(port);