File 0009-Set-CLOEXEC-flag-for-pipes-in-PulseAudio-plugins.patch of Package alsa-plugins
From edfb903f625b7193c4127e91cbe641ba5f421c27 Mon Sep 17 00:00:00 2001
From: Chris Rankin <rankincj@yahoo.com>
Date: Tue, 27 Sep 2011 09:44:15 +0200
Subject: [PATCH] Set CLOEXEC flag for pipes in PulseAudio plugins
I have noticed that Alsa / PulseAudio are leaking a couple of pipes after a
fork/exec, and have traced the leak to the following two plugins:
libasound_module_ctl_pulse.so
libasound_module_pcm_pulse.so
This is with Fedora 15. I have attached a patch for the problem.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
pulse/pulse.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/pulse/pulse.c b/pulse/pulse.c
index c34671b..cf0546b 100644
--- a/pulse/pulse.c
+++ b/pulse/pulse.c
@@ -114,6 +114,11 @@ static int make_nonblock(int fd) {
return fcntl(fd, F_SETFL, fl | O_NONBLOCK);
}
+static int make_close_on_exec(int fd)
+{
+ return fcntl(fd, F_SETFD, FD_CLOEXEC);
+}
+
snd_pulse_t *pulse_new(void)
{
snd_pulse_t *p;
@@ -134,7 +139,9 @@ snd_pulse_t *pulse_new(void)
p->thread_fd = fd[1];
make_nonblock(p->main_fd);
+ make_close_on_exec(p->main_fd);
make_nonblock(p->thread_fd);
+ make_close_on_exec(p->thread_fd);
p->mainloop = pa_threaded_mainloop_new();
if (!p->mainloop)
--
1.7.6.1