summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/input')
-rw-r--r--src/input/input_cdda.c2
-rw-r--r--src/input/input_dvb.c16
-rw-r--r--src/input/input_file.c2
-rw-r--r--src/input/input_net.c31
-rw-r--r--src/input/input_pvr.c10
-rw-r--r--src/input/input_stdin_fifo.c6
-rw-r--r--src/input/input_v4l.c8
-rw-r--r--src/input/input_vcd.c6
-rw-r--r--src/input/media_helper.c2
9 files changed, 29 insertions, 54 deletions
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c
index 00c305ea1..052a1b257 100644
--- a/src/input/input_cdda.c
+++ b/src/input/input_cdda.c
@@ -1951,7 +1951,7 @@ static int cdda_open(cdda_input_plugin_t *this_gen,
/* We use O_NONBLOCK for when /proc/sys/dev/cdrom/check_media is at 1 on
* Linux systems */
- fd = open_cloexec(cdda_device, O_RDONLY | O_NONBLOCK);
+ fd = xine_open_cloexec(cdda_device, O_RDONLY | O_NONBLOCK);
if (fd == -1) {
return -1;
}
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index cae56d301..fc6e2b7c4 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -606,7 +606,7 @@ static tuner_t *XINE_MALLOC tuner_init(xine_t * xine, int adapter)
snprintf(this->dvr_device,100,"/dev/dvb/adapter%i/dvr0",this->adapter_num);
snprintf(video_device,100,"/dev/dvb/adapter%i/video0",this->adapter_num);
- if ((this->fd_frontend = open_cloexec(this->frontend_device, O_RDWR)) < 0) {
+ if ((this->fd_frontend = xine_open_cloexec(this->frontend_device, O_RDWR)) < 0) {
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FRONTEND DEVICE: %s\n", strerror(errno));
tuner_dispose(this);
return NULL;
@@ -619,7 +619,7 @@ static tuner_t *XINE_MALLOC tuner_init(xine_t * xine, int adapter)
}
for (x = 0; x < MAX_FILTERS; x++) {
- this->fd_pidfilter[x] = open_cloexec(this->demux_device, O_RDWR);
+ this->fd_pidfilter[x] = xine_open_cloexec(this->demux_device, O_RDWR);
if (this->fd_pidfilter[x] < 0) {
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "DEMUX DEVICE PIDfilter: %s\n", strerror(errno));
tuner_dispose(this);
@@ -627,7 +627,7 @@ static tuner_t *XINE_MALLOC tuner_init(xine_t * xine, int adapter)
}
}
for (x = 0; x < MAX_SUBTITLES; x++) {
- this->fd_subfilter[x] = open_cloexec(this->demux_device, O_RDWR);
+ this->fd_subfilter[x] = xine_open_cloexec(this->demux_device, O_RDWR);
if (this->fd_subfilter[x] < 0) {
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "DEMUX DEVICE Subtitle filter: %s\n", strerror(errno));
}
@@ -648,7 +648,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_cloexec(video_device, O_RDWR)) < 0) {
+ if ((test_video=xine_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");
@@ -2140,7 +2140,7 @@ static int switch_channel(dvb_input_plugin_t *this, int channel) {
for (x = 0; x < MAX_FILTERS; x++) {
close(this->tuner->fd_pidfilter[x]);
- this->tuner->fd_pidfilter[x] = open_cloexec(this->tuner->demux_device, O_RDWR);
+ this->tuner->fd_pidfilter[x] = xine_open_cloexec(this->tuner->demux_device, O_RDWR);
}
if (!tuner_set_channel (this, &this->channels[channel])) {
@@ -2174,7 +2174,7 @@ static int switch_channel(dvb_input_plugin_t *this, int channel) {
this->channel = channel;
- this->fd = open_cloexec(this->tuner->dvr_device, O_RDONLY | O_NONBLOCK);
+ this->fd = xine_open_cloexec(this->tuner->dvr_device, O_RDONLY | O_NONBLOCK);
this->tuned_in = 1;
pthread_mutex_unlock (&this->channel_change_mutex);
@@ -2248,7 +2248,7 @@ static void do_record (dvb_input_plugin_t *this) {
}
/* start recording */
- this->record_fd = create_cloexec(filename, O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ this->record_fd = xine_create_cloexec(filename, O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
this->stream->osd_renderer->clear (this->rec_osd);
@@ -2992,7 +2992,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen)
return 0;
}
- if ((this->fd = open_cloexec(this->tuner->dvr_device, O_RDONLY |O_NONBLOCK)) < 0) {
+ if ((this->fd = xine_open_cloexec(this->tuner->dvr_device, O_RDONLY |O_NONBLOCK)) < 0) {
xprintf(this->class->xine, XINE_VERBOSITY_LOG,
_("input_dvb: cannot open dvr device '%s'\n"), this->tuner->dvr_device);
return 0;
diff --git a/src/input/input_file.c b/src/input/input_file.c
index b8d2b12b7..d5313d4dc 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.c
@@ -362,7 +362,7 @@ static int file_plugin_open (input_plugin_t *this_gen ) {
else
filename = strdup(this->mrl); /* NEVER unescape plain file names! */
- this->fh = open_cloexec(filename, O_RDONLY|O_BINARY);
+ this->fh = xine_open_cloexec(filename, O_RDONLY|O_BINARY);
if (this->fh == -1) {
if (errno == EACCES) {
diff --git a/src/input/input_net.c b/src/input/input_net.c
index 076c11634..5c927a6d5 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -115,25 +115,13 @@ static int host_connect_attempt_ipv4(struct in_addr ia, int port, xine_t *xine)
int s;
struct sockaddr_in sin;
- s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+ s = xine_socket_cloexec(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s==-1) {
xine_log(xine, XINE_LOG_MSG,
_("input_net: socket(): %s\n"), strerror(errno));
return -1;
}
-#ifndef WIN32
- if (fcntl(s, F_SETFD, FD_CLOEXEC) < 0) {
- xine_log(xine, XINE_LOG_MSG,
- _("input_net: Failed to make socket uninheritable (%s)\n"),
- strerror(errno));
- }
-#else
- if (!SetHandleInformation((HANDLE)s, HANDLE_FLAG_INHERIT, 0)) {
- xine_log(xine, XINE_LOG_MSG, "Failed to make socket uninheritable\n");
- }
-#endif
-
sin.sin_family = AF_INET;
sin.sin_addr = ia;
sin.sin_port = htons(port);
@@ -155,28 +143,15 @@ static int host_connect_attempt_ipv4(struct in_addr ia, int port, xine_t *xine)
#else
static int host_connect_attempt(int family, struct sockaddr* sin, int addrlen, xine_t *xine) {
- int s;
+ int s = xine_socket_cloexec(family, SOCK_STREAM, IPPROTO_TCP);
- s = socket(family, SOCK_STREAM, IPPROTO_TCP);
- if (s==-1) {
+ if (s == -1) {
xine_log(xine, XINE_LOG_MSG,
_("input_net: socket(): %s\n"), strerror(errno));
return -1;
}
#ifndef WIN32
- if (fcntl(s, F_SETFD, FD_CLOEXEC) < 0) {
- xine_log(xine, XINE_LOG_MSG,
- _("input_net: Failed to make socket uninheritable (%s)\n"),
- strerror(errno));
- }
-#else
- if (!SetHandleInformation((HANDLE)s, HANDLE_FLAG_INHERIT, 0)) {
- xine_log(xine, XINE_LOG_MSG, "Failed to make socket uninheritable\n");
- }
-#endif
-
-#ifndef WIN32
if (connect(s, sin, addrlen)==-1 && errno != EINPROGRESS)
#else
if (connect(s, sin, addrlen)==-1 && WSAGetLastError() != WSAEINPROGRESS)
diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c
index 7ccad806e..875fb84b0 100644
--- a/src/input/input_pvr.c
+++ b/src/input/input_pvr.c
@@ -583,7 +583,7 @@ static int pvr_break_rec_page (pvr_input_plugin_t *this) {
lprintf("opening pvr file for writing (%s)\n", filename);
- this->rec_fd = create_cloexec(filename, O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ this->rec_fd = xine_create_cloexec(filename, O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if( this->rec_fd == -1 ) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("input_pvr: error creating pvr file (%s)\n"), filename);
@@ -740,7 +740,7 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t
lprintf("opening pvr file for reading (%s)\n", filename);
- this->play_fd = open_cloexec(filename, O_RDONLY);
+ this->play_fd = xine_open_cloexec(filename, O_RDONLY);
if( this->play_fd == -1 ) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("input_pvr: error opening pvr file (%s)\n"), filename);
@@ -1008,7 +1008,7 @@ static void pvr_event_handler (pvr_input_plugin_t *this) {
/* as of ivtv 0.10.6: must close and reopen to set input */
close(this->dev_fd);
- this->dev_fd = open_cloexec(this->class->devname, O_RDWR);
+ this->dev_fd = xine_open_cloexec(this->class->devname, O_RDWR);
if (this->dev_fd < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"input_pvr: error opening device %s\n", this->class->devname );
@@ -1155,7 +1155,7 @@ static void pvr_event_handler (pvr_input_plugin_t *this) {
/* how lame. we must close and reopen to change bitrate. */
close(this->dev_fd);
- this->dev_fd = open_cloexec(this->class->devname, O_RDWR);
+ this->dev_fd = xine_open_cloexec(this->class->devname, O_RDWR);
if (this->dev_fd == -1) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("input_pvr: error opening device %s\n"), this->class->devname );
@@ -1415,7 +1415,7 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) {
this->saved_id = 0;
- this->dev_fd = open_cloexec(this->class->devname, O_RDWR);
+ this->dev_fd = xine_open_cloexec(this->class->devname, O_RDWR);
if (this->dev_fd == -1) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("input_pvr: error opening device %s\n"), this->class->devname );
diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
index c73488722..d3a2e83e1 100644
--- a/src/input/input_stdin_fifo.c
+++ b/src/input/input_stdin_fifo.c
@@ -250,10 +250,10 @@ static int stdin_plugin_open (input_plugin_t *this_gen ) {
lprintf ("trying to open '%s'...\n", this->mrl);
if (this->fh == -1) {
- char *filename;
+ const char *filename;
- filename = (char *) &this->mrl[5];
- this->fh = open_cloexec(filename, FILE_FLAGS);
+ filename = (const char *) &this->mrl[5];
+ this->fh = xine_open_cloexec(filename, FILE_FLAGS);
lprintf("filename '%s'\n", filename);
diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c
index 68ed44b9c..b88c4821d 100644
--- a/src/input/input_v4l.c
+++ b/src/input/input_v4l.c
@@ -797,7 +797,7 @@ static int open_radio_capture_device(v4l_input_plugin_t *this)
entry = this->stream->xine->config->lookup_entry(this->stream->xine->config,
"media.video4linux.radio_device");
- if((this->radio_fd = open_cloexec(entry->str_value, O_RDWR)) < 0) {
+ if((this->radio_fd = xine_open_cloexec(entry->str_value, O_RDWR)) < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
"input_v4l: error opening v4l device (%s): %s\n",
entry->str_value, strerror(errno));
@@ -850,7 +850,7 @@ static int open_video_capture_device(v4l_input_plugin_t *this)
"media.video4linux.video_device");
/* Try to open the video device */
- if((this->video_fd = open_cloexec(entry->str_value, O_RDWR)) < 0) {
+ if((this->video_fd = xine_open_cloexec(entry->str_value, O_RDWR)) < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
"input_v4l: error opening v4l device (%s): %s\n",
entry->str_value, strerror(errno));
@@ -1770,7 +1770,7 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen,
"media.video4linux.video_device");
/* Try to open the video device */
- if((this->video_fd = open_cloexec(entry->str_value, O_RDWR)) < 0) {
+ if((this->video_fd = xine_open_cloexec(entry->str_value, O_RDWR)) < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
"input_v4l: error opening v4l device (%s): %s\n",
entry->str_value, strerror(errno));
@@ -1833,7 +1833,7 @@ static input_plugin_t *v4l_class_get_radio_instance (input_class_t *cls_gen,
entry = this->stream->xine->config->lookup_entry(this->stream->xine->config,
"media.video4linux.radio_device");
- if((this->radio_fd = open_cloexec(entry->str_value, O_RDWR)) < 0) {
+ if((this->radio_fd = xine_open_cloexec(entry->str_value, O_RDWR)) < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
"input_v4l: error opening v4l device (%s): %s\n",
entry->str_value, strerror(errno));
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 1da5b2839..20bf8c845 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.c
@@ -829,7 +829,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen) {
char *filename;
int fd;
- fd = open_cloexec(cls->device, O_RDONLY|O_EXCL);
+ fd = xine_open_cloexec(cls->device, O_RDONLY|O_EXCL);
if (fd == -1) {
return 0;
}
@@ -972,7 +972,7 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file
return NULL;
- fd = open_cloexec(this->device, O_RDONLY|O_EXCL);
+ fd = xine_open_cloexec(this->device, O_RDONLY|O_EXCL);
if (fd == -1) {
xprintf (this->xine, XINE_VERBOSITY_LOG,
@@ -1034,7 +1034,7 @@ static char ** vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_fi
int i, fd;
- fd = open_cloexec(this->device, O_RDONLY|O_EXCL);
+ fd = xine_open_cloexec(this->device, O_RDONLY|O_EXCL);
if (fd == -1) {
xprintf (this->xine, XINE_VERBOSITY_LOG,
diff --git a/src/input/media_helper.c b/src/input/media_helper.c
index 616793499..1a82a406c 100644
--- a/src/input/media_helper.c
+++ b/src/input/media_helper.c
@@ -99,7 +99,7 @@ int media_eject_media (xine_t *xine, const char *device)
media_umount_media(device);
/* printf("input_dvd: umount result: %s\n", strerror(errno)); */
- if ((fd = open_cloexec(device, O_RDONLY|O_NONBLOCK)) > -1) {
+ if ((fd = xine_open_cloexec(device, O_RDONLY|O_NONBLOCK)) > -1) {
#if defined (__linux__)
int ret, status;