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/libw32dll | |
| 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/libw32dll')
| -rw-r--r-- | src/libw32dll/wine/registry.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libw32dll/wine/registry.c b/src/libw32dll/wine/registry.c index b12974416..45e44625c 100644 --- a/src/libw32dll/wine/registry.c +++ b/src/libw32dll/wine/registry.c @@ -90,7 +90,7 @@ static void open_registry(void) printf("Multiple open_registry(>\n"); return; } - fd = open(localregpathname, O_RDONLY); + fd = open_cloexec(localregpathname, O_RDONLY); if (fd == -1) { printf("Creating new registry\n"); @@ -133,7 +133,7 @@ static void save_registry(void) int fd, i; if (!regs) init_registry(); - fd = open(localregpathname, O_WRONLY | O_CREAT, 00666); + fd = create_cloexec(localregpathname, O_WRONLY, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if (fd == -1) { printf("Failed to open registry file '%s' for writing.\n", |
