mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
make use F_CLOEXEC wherever useful
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@174 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
348738751c
commit
5f52999c01
9 changed files with 35 additions and 1 deletions
15
polyp/util.c
15
polyp/util.c
|
|
@ -249,3 +249,18 @@ void pa_reset_priority(void) {
|
|||
|
||||
setpriority(PRIO_PROCESS, 0, 0);
|
||||
}
|
||||
|
||||
int pa_fd_set_cloexec(int fd, int b) {
|
||||
int v;
|
||||
assert(fd >= 0);
|
||||
|
||||
if ((v = fcntl(fd, F_GETFD, 0)) < 0)
|
||||
return -1;
|
||||
|
||||
v = (v & ~FD_CLOEXEC) | (b ? FD_CLOEXEC : 0);
|
||||
|
||||
if (fcntl(fd, F_SETFD, v) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue