Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:zhy20120210:3
alsa
alsa-lib-open-device-close-on-exec.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File alsa-lib-open-device-close-on-exec.diff of Package alsa
From 8264b2fd0a56ba10979a3512993301be14cb2c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net> Date: Sat, 7 Nov 2009 21:29:23 +0200 Subject: [PATCH] Open device nodes with close-on-exec flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Denis-Courmont <remi@remlab.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> --- include/local.h | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/include/local.h b/include/local.h index b5a1c45..fa3f0b7 100644 --- a/include/local.h +++ b/include/local.h @@ -230,22 +230,28 @@ extern snd_lib_error_handler_t snd_err_msg; # define link_warning(symbol, msg) #endif -/* open with resmgr */ -#ifdef SUPPORT_RESMGR static inline int snd_open_device(const char *filename, int fmode) { - int fd = open(filename, fmode); + int fd; + +#ifdef O_CLOEXEC + fmode |= O_CLOEXEC; +#endif + fd = open(filename, fmode); + +/* open with resmgr */ +#ifdef SUPPORT_RESMGR + if (fd < 0) { + if (errno == EAGAIN || errno == EBUSY) + return fd; + if (! access(filename, F_OK)) + fd = rsm_open_device(filename, fmode); + } +#endif if (fd >= 0) - return fd; - if (errno == EAGAIN || errno == EBUSY) - return fd; - if (! access(filename, F_OK)) - return rsm_open_device(filename, fmode); - return -1; + fcntl(fd, F_SETFD, FD_CLOEXEC); + return fd; } -#else -#define snd_open_device(filename, fmode) open(filename, fmode); -#endif /* make local functions really local */ #define snd_dlobj_cache_lookup \ -- 1.6.6.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor