summaryrefslogtreecommitdiff
path: root/src/video_out
diff options
context:
space:
mode:
authorChris Rankin <rankincj@yahoo.com>2011-10-01 14:14:27 +0100
committerChris Rankin <rankincj@yahoo.com>2011-10-01 14:14:27 +0100
commit62a669d9f04e83debe729347617a935707badc7e (patch)
tree3d71d5520db6c429666abf1823d2d20b082af97d /src/video_out
parent8ba50d7512e71ce2fa441f8e738459df21cec2ae (diff)
downloadxine-lib-62a669d9f04e83debe729347617a935707badc7e.tar.gz
xine-lib-62a669d9f04e83debe729347617a935707badc7e.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/video_out')
-rw-r--r--src/video_out/video_out_fb.c6
-rw-r--r--src/video_out/video_out_pgx64.c2
-rw-r--r--src/video_out/video_out_syncfb.c4
-rw-r--r--src/video_out/video_out_vidix.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c
index 315e77e66..752a18a27 100644
--- a/src/video_out/video_out_fb.c
+++ b/src/video_out/video_out_fb.c
@@ -825,17 +825,17 @@ static int open_fb_device(config_values_t *config, xine_t *xine)
XINE_CONFIG_SECURITY, NULL, NULL);
if(strlen(device_name) > 3)
{
- fd = open(device_name, O_RDWR);
+ fd = open_cloexec(device_name, O_RDWR);
}
else
{
device_name = "/dev/fb1";
- fd = open(device_name, O_RDWR);
+ fd = open_cloexec(device_name, O_RDWR);
if(fd < 0)
{
device_name = "/dev/fb0";
- fd = open(device_name, O_RDWR);
+ fd = open_cloexec(device_name, O_RDWR);
}
}
diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c
index c9ec38aa8..8f46e2dde 100644
--- a/src/video_out/video_out_pgx64.c
+++ b/src/video_out/video_out_pgx64.c
@@ -292,7 +292,7 @@ static int setup_dga(pgx64_driver_t *this)
devname = dga_draw_devname(this->dgadraw);
DGA_DRAW_UNLOCK(this->dgadraw);
- if ((this->devfd = open(devname, O_RDWR)) < 0) {
+ if ((this->devfd = open_cloexec(devname, O_RDWR)) < 0) {
xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx64: Error: can't open framebuffer device '%s'\n"), devname);
XDgaUnGrabDrawable(this->dgadraw);
XUnlockDisplay(this->display);
diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c
index b3385a943..ac79f7740 100644
--- a/src/video_out/video_out_syncfb.c
+++ b/src/video_out/video_out_syncfb.c
@@ -888,7 +888,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
_x_alphablend_init(&this->alphablend_extra_data, class->xine);
/* check for syncfb device */
- if((this->fd = open(class->device_name, O_RDWR)) < 0) {
+ if((this->fd = open_cloexec(class->device_name, O_RDWR)) < 0) {
xprintf(class->xine, XINE_VERBOSITY_DEBUG,
"video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", class->device_name);
free(this);
@@ -1095,7 +1095,7 @@ static void *init_class (xine_t *xine, void *visual_gen) {
XINE_CONFIG_SECURITY, NULL, NULL);
/* check for syncfb device */
- if((fd = open(device_name, O_RDWR)) < 0) {
+ if((fd = open_cloexec(device_name, O_RDWR)) < 0) {
xprintf(xine, XINE_VERBOSITY_DEBUG,
"video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", device_name);
return NULL;
diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c
index 8298d3ede..b70844312 100644
--- a/src/video_out/video_out_vidix.c
+++ b/src/video_out/video_out_vidix.c
@@ -1257,7 +1257,7 @@ static vo_driver_t *vidixfb_open_plugin (video_driver_class_t *class_gen, const
XINE_CONFIG_SECURITY, NULL, NULL);
/* Open fb device for reading */
- if((fd = open("/dev/fb0", O_RDONLY)) < 0) {
+ if((fd = open_cloexec("/dev/fb0", O_RDONLY)) < 0) {
xprintf(this->xine, XINE_VERBOSITY_DEBUG,
"video_out_vidix: unable to open frame buffer device \"%s\": %s\n", device, strerror(errno));
return NULL;