diff options
author | Chris Rankin <rankincj@yahoo.com> | 2011-10-03 01:34:37 +0100 |
---|---|---|
committer | Chris Rankin <rankincj@yahoo.com> | 2011-10-03 01:34:37 +0100 |
commit | 154d771692a1ca9b9af5eb0acc12885ca852307a (patch) | |
tree | 1ecf86dfa2c8c0397bc7b23a48886009ebecdb7e /src/audio_out/audio_sun_out.c | |
parent | d7c4d2bd622b1405ff520006dbeaf739e9725a89 (diff) | |
download | xine-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/audio_out/audio_sun_out.c')
-rw-r--r-- | src/audio_out/audio_sun_out.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c index 5b5f39365..029545544 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -160,7 +160,7 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) if (silence == NULL) goto error; - if ((fd = open(dev, O_WRONLY|O_NONBLOCK)) < 0) + if ((fd = open_cloexec(dev, O_WRONLY|O_NONBLOCK)) < 0) goto error; /* We wanted non blocking open but now put it back to normal */ @@ -449,7 +449,7 @@ static int ao_sun_open(ao_driver_t *this_gen, * open audio device */ - this->audio_fd = open(this->audio_dev, O_WRONLY|O_NONBLOCK); + this->audio_fd = open_cloexec(this->audio_dev, O_WRONLY|O_NONBLOCK); if(this->audio_fd < 0) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_sun_out: opening audio device %s failed: %s\n"), this->audio_dev, strerror(errno)); @@ -939,8 +939,8 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v /* * open the device */ - - this->audio_fd = open(this->audio_dev = devname, O_WRONLY|O_NONBLOCK); + this->audio_dev = devname; + this->audio_fd = open_cloexec(devname, O_WRONLY|O_NONBLOCK); if(this->audio_fd < 0) { |