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_file_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_file_out.c')
-rw-r--r-- | src/audio_out/audio_file_out.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/audio_out/audio_file_out.c b/src/audio_out/audio_file_out.c index 85ee8ad48..352e3421e 100644 --- a/src/audio_out/audio_file_out.c +++ b/src/audio_out/audio_file_out.c @@ -115,7 +115,7 @@ static int ao_file_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int if (!this->fname) this->fname = "xine-out.wav"; - this->fd = open(this->fname, O_WRONLY|O_TRUNC|O_CREAT, 0644); + this->fd = create_cloexec(this->fname, O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if (this->fd == -1) { xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_file_out: Failed to open file '%s': %s\n", |