summaryrefslogtreecommitdiff
path: root/src/input/input_pvr.c
diff options
context:
space:
mode:
authorChris Rankin <rankincj@yahoo.com>2011-10-03 01:34:37 +0100
committerChris Rankin <rankincj@yahoo.com>2011-10-03 01:34:37 +0100
commit154d771692a1ca9b9af5eb0acc12885ca852307a (patch)
tree1ecf86dfa2c8c0397bc7b23a48886009ebecdb7e /src/input/input_pvr.c
parentd7c4d2bd622b1405ff520006dbeaf739e9725a89 (diff)
downloadxine-lib-154d771692a1ca9b9af5eb0acc12885ca852307a.tar.gz
xine-lib-154d771692a1ca9b9af5eb0acc12885ca852307a.tar.bz2
Mark simple file and socket descriptors as uninheritable.
This patch creates two utility functions: int open_cloexec(pathname, flags) int create_cloexec(pathname, flags, mode) These return a file descriptor with the CLOEXEC flag set, to ensure that the descriptor is not inherited across a fork/exec operation. The sockets returned by: _x_io_tcp_connect_ipv4() _x_io_tcp_connect() now also have their CLOEXEC flag set.
Diffstat (limited to 'src/input/input_pvr.c')
-rw-r--r--src/input/input_pvr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c
index 288434c47..7e04c0bc9 100644
--- a/src/input/input_pvr.c
+++ b/src/input/input_pvr.c
@@ -584,7 +584,7 @@ static int pvr_break_rec_page (pvr_input_plugin_t *this) {
lprintf("opening pvr file for writing (%s)\n", filename);
- this->rec_fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0666 );
+ this->rec_fd = 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);
@@ -741,7 +741,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(filename, O_RDONLY );
+ this->play_fd = 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);
@@ -1009,7 +1009,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 (this->class->devname, O_RDWR);
+ this->dev_fd = 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 );
@@ -1156,7 +1156,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 (this->class->devname, O_RDWR);
+ this->dev_fd = 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 );
@@ -1416,7 +1416,7 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) {
this->saved_id = 0;
- this->dev_fd = open (this->class->devname, O_RDWR);
+ this->dev_fd = 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 );