summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/alsa/mixer/paths/analog-input.conf.common31
-rw-r--r--src/modules/alsa/mixer/paths/analog-output-headphones-2.conf82
-rw-r--r--src/modules/alsa/mixer/paths/analog-output-headphones.conf7
-rw-r--r--src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf4
-rw-r--r--src/modules/alsa/mixer/paths/analog-output-mono.conf4
-rw-r--r--src/modules/alsa/mixer/paths/analog-output-speaker.conf94
-rw-r--r--src/modules/alsa/mixer/paths/analog-output.conf15
-rw-r--r--src/modules/alsa/mixer/profile-sets/default.conf14
-rw-r--r--src/modules/bluetooth/bluetooth-util.c10
-rw-r--r--src/modules/module-cli.c2
-rw-r--r--src/modules/module-default-device-restore.c8
-rw-r--r--src/modules/module-detect.c8
-rw-r--r--src/modules/module-match.c2
-rw-r--r--src/modules/module-mmkbd-evdev.c2
-rw-r--r--src/modules/module-pipe-sink.c3
-rw-r--r--src/modules/module-pipe-source.c3
-rw-r--r--src/modules/module-solaris.c2
-rw-r--r--src/modules/module-udev-detect.c2
-rw-r--r--src/modules/oss/oss-util.c18
-rw-r--r--src/modules/rtp/module-rtp-recv.c2
-rw-r--r--src/modules/rtp/module-rtp-send.c6
21 files changed, 271 insertions, 48 deletions
diff --git a/src/modules/alsa/mixer/paths/analog-input.conf.common b/src/modules/alsa/mixer/paths/analog-input.conf.common
index 87af38b3..951e11fa 100644
--- a/src/modules/alsa/mixer/paths/analog-input.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-input.conf.common
@@ -98,7 +98,11 @@ priority = 18
name = input-docking
priority = 17
-;;; ' Capture Source'
+[Option Input Source:AUX IN]
+name = input
+priority = 10
+
+;;; 'Capture Source'
[Element Capture Source]
enumeration = select
@@ -244,6 +248,31 @@ name = input-docking
[Option Capture Source:Dock Mic]
name = input-docking-microphone
+;;; 'Mic Jack Mode'
+
+[Element Mic Jack Mode]
+enumeration = select
+
+[Option Mic Jack Mode:Mic In]
+name = input-microphone
+
+[Option Mic Jack Mode:Line In]
+name = input-linein
+
+;;; 'Digital Input Source'
+
+[Element Digital Input Source]
+enumeration = select
+
+[Option Digital Input Source:Analog Inputs]
+name = input
+
+[Option Digital Input Source:Digital Mic 1]
+name = input-microphone
+
+[Option Digital Input Source:Digital Mic 2]
+name = input-microphone
+
;;; Various Boosts
[Element Capture Boost]
diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf b/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf
new file mode 100644
index 00000000..f2fd31c7
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf
@@ -0,0 +1,82 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+; Path for mixers that have a 'Headphone2' control
+;
+; See analog-output.conf.common for an explanation on the directives
+
+[General]
+priority = 89
+
+[Element Hardware Master]
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Master]
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Master Mono]
+switch = off
+volume = off
+
+; This profile path is intended to control the second headphones, not
+; the first headphones. But it should not hurt if we leave the
+; headphone jack enabled nonetheless.
+[Element Headphone]
+switch = mute
+volume = zero
+
+[Element Headphone2]
+required = any
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Speaker]
+switch = off
+volume = off
+
+[Element Front]
+switch = off
+volume = off
+
+[Element Rear]
+switch = off
+volume = off
+
+[Element Surround]
+switch = off
+volume = off
+
+[Element Side]
+switch = off
+volume = off
+
+[Element Center]
+switch = off
+volume = off
+
+[Element LFE]
+switch = off
+volume = off
+
+.include analog-output.conf.common
diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones.conf b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
index 61d2e297..2131cfe8 100644
--- a/src/modules/alsa/mixer/paths/analog-output-headphones.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
@@ -44,6 +44,13 @@ volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
+; This profile path is intended to control the first headphones, not
+; the second headphones. But it should not hurt if we leave the second
+; headphone jack enabled nonetheless.
+[Element Headphone2]
+switch = mute
+volume = zero
+
[Element Speaker]
switch = off
volume = off
diff --git a/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf b/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf
index 911361d7..0a43e271 100644
--- a/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf
@@ -48,6 +48,10 @@ override-map.2 = lfe,lfe
switch = mute
volume = zero
+[Element Headphone2]
+switch = mute
+volume = zero
+
[Element Speaker]
switch = mute
volume = merge
diff --git a/src/modules/alsa/mixer/paths/analog-output-mono.conf b/src/modules/alsa/mixer/paths/analog-output-mono.conf
index 2fbc60b7..542edc40 100644
--- a/src/modules/alsa/mixer/paths/analog-output-mono.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-mono.conf
@@ -45,6 +45,10 @@ override-map.2 = all-left,all-right
switch = mute
volume = zero
+[Element Headphone2]
+switch = mute
+volume = zero
+
[Element Speaker]
switch = mute
volume = merge
diff --git a/src/modules/alsa/mixer/paths/analog-output-speaker.conf b/src/modules/alsa/mixer/paths/analog-output-speaker.conf
new file mode 100644
index 00000000..aea78534
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/analog-output-speaker.conf
@@ -0,0 +1,94 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+; Path for mixers that have a 'Speaker' control
+;
+; See analog-output.conf.common for an explanation on the directives
+
+[General]
+priority = 100
+
+[Element Hardware Master]
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Master]
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Master Mono]
+switch = off
+volume = off
+
+; This profile path is intended to control the speaker, not the
+; headphones. But it should not hurt if we leave the headphone jack
+; enabled nonetheless.
+[Element Headphone]
+switch = mute
+volume = zero
+
+[Element Headphone2]
+switch = mute
+volume = zero
+
+[Element Speaker]
+required = any
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Front]
+switch = mute
+volume = merge
+override-map.1 = all-front
+override-map.2 = front-left,front-right
+
+[Element Rear]
+switch = mute
+volume = merge
+override-map.1 = all-rear
+override-map.2 = rear-left,rear-right
+
+[Element Surround]
+switch = mute
+volume = merge
+override-map.1 = all-rear
+override-map.2 = rear-left,rear-right
+
+[Element Side]
+switch = mute
+volume = merge
+override-map.1 = all-side
+override-map.2 = side-left,side-right
+
+[Element Center]
+switch = mute
+volume = merge
+override-map.1 = all-center
+override-map.2 = all-center,all-center
+
+[Element LFE]
+switch = mute
+volume = merge
+override-map.1 = lfe
+override-map.2 = lfe,lfe
+
+.include analog-output.conf.common
diff --git a/src/modules/alsa/mixer/paths/analog-output.conf b/src/modules/alsa/mixer/paths/analog-output.conf
index f71a05a1..d7c1223b 100644
--- a/src/modules/alsa/mixer/paths/analog-output.conf
+++ b/src/modules/alsa/mixer/paths/analog-output.conf
@@ -14,12 +14,13 @@
# along with PulseAudio; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-; Intended for the 'default' output
+; Intended for the 'default' output. Note that a-o-speaker.conf has a
+; higher priority than this
;
; See analog-output.conf.common for an explanation on the directives
[General]
-priority = 100
+priority = 99
[Element Hardware Master]
switch = mute
@@ -37,18 +38,20 @@ override-map.2 = all-left,all-right
switch = off
volume = off
-; This profile path is intended to control the speaker, not the
+; This profile path is intended to control the default output, not the
; headphones. But it should not hurt if we leave the headphone jack
; enabled nonetheless.
[Element Headphone]
switch = mute
volume = zero
+[Element Headphone2]
+switch = mute
+volume = zero
+
[Element Speaker]
switch = mute
-volume = merge
-override-map.1 = all
-override-map.2 = all-left,all-right
+volume = off
[Element Front]
switch = mute
diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf
index ac41a8d3..046938fc 100644
--- a/src/modules/alsa/mixer/profile-sets/default.conf
+++ b/src/modules/alsa/mixer/profile-sets/default.conf
@@ -62,42 +62,42 @@ auto-profiles = yes
[Mapping analog-mono]
device-strings = hw:%f
channel-map = mono
-paths-output = analog-output analog-output-headphones analog-output-mono analog-output-lfe-on-mono
+paths-output = analog-output analog-output-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono
paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
priority = 1
[Mapping analog-stereo]
device-strings = front:%f hw:%f
channel-map = left,right
-paths-output = analog-output analog-output-headphones analog-output-mono analog-output-lfe-on-mono
+paths-output = analog-output analog-output-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono
paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
priority = 10
[Mapping analog-surround-40]
device-strings = surround40:%f
channel-map = front-left,front-right,rear-left,rear-right
-paths-output = analog-output analog-output-lfe-on-mono
+paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono
priority = 7
direction = output
[Mapping analog-surround-41]
device-strings = surround41:%f
channel-map = front-left,front-right,rear-left,rear-right,lfe
-paths-output = analog-output analog-output-lfe-on-mono
+paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono
priority = 8
direction = output
[Mapping analog-surround-50]
device-strings = surround50:%f
channel-map = front-left,front-right,rear-left,rear-right,front-center
-paths-output = analog-output analog-output-lfe-on-mono
+paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono
priority = 7
direction = output
[Mapping analog-surround-51]
device-strings = surround51:%f
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
-paths-output = analog-output analog-output-lfe-on-mono
+paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono
priority = 8
direction = output
@@ -105,7 +105,7 @@ direction = output
device-strings = surround71:%f
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
description = Analog Surround 7.1
-paths-output = analog-output analog-output-lfe-on-mono
+paths-output = analog-output analog-output-speaker analog-output-lfe-on-mono
priority = 7
direction = output
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index f8c5b778..47d62005 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -723,12 +723,14 @@ const pa_bluetooth_device* pa_bluetooth_discovery_get_by_address(pa_bluetooth_di
while ((d = pa_hashmap_iterate(y->devices, &state, NULL)))
if (pa_streq(d->address, address))
- return d;
+ return device_is_audio(d) ? d : NULL;
return NULL;
}
const pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_discovery *y, const char* path) {
+ pa_bluetooth_device *d;
+
pa_assert(y);
pa_assert(PA_REFCNT_VALUE(y) > 0);
pa_assert(path);
@@ -736,7 +738,11 @@ const pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_disco
if (!pa_hook_is_firing(&y->hook))
pa_bluetooth_discovery_sync(y);
- return pa_hashmap_get(y->devices, path);
+ if ((d = pa_hashmap_get(y->devices, path)))
+ if (device_is_audio(d))
+ return d;
+
+ return NULL;
}
static int setup_dbus(pa_bluetooth_discovery *y) {
diff --git a/src/modules/module-cli.c b/src/modules/module-cli.c
index 6bd0f4fc..c5ff4564 100644
--- a/src/modules/module-cli.c
+++ b/src/modules/module-cli.c
@@ -105,7 +105,7 @@ int pa__init(pa_module*m) {
* of log messages, particularly because if stdout and stderr are
* dup'ed they share the same O_NDELAY, too. */
- if ((fd = open("/dev/tty", O_RDWR|O_CLOEXEC|O_NONBLOCK)) >= 0) {
+ if ((fd = pa_open_cloexec("/dev/tty", O_RDWR|O_NONBLOCK, 0)) >= 0) {
io = pa_iochannel_new(m->core->mainloop, fd, fd);
pa_log_debug("Managed to open /dev/tty.");
} else {
diff --git a/src/modules/module-default-device-restore.c b/src/modules/module-default-device-restore.c
index 27ae60e5..94f589e9 100644
--- a/src/modules/module-default-device-restore.c
+++ b/src/modules/module-default-device-restore.c
@@ -60,7 +60,7 @@ static void load(struct userdata *u) {
if (u->core->default_sink)
pa_log_info("Manually configured default sink, not overwriting.");
- else if ((f = fopen(u->sink_filename, "r"))) {
+ else if ((f = pa_fopen_cloexec(u->sink_filename, "r"))) {
char ln[256] = "";
pa_sink *s;
@@ -81,7 +81,7 @@ static void load(struct userdata *u) {
if (u->core->default_source)
pa_log_info("Manually configured default source, not overwriting.");
- else if ((f = fopen(u->source_filename, "r"))) {
+ else if ((f = pa_fopen_cloexec(u->source_filename, "r"))) {
char ln[256] = "";
pa_source *s;
@@ -108,7 +108,7 @@ static void save(struct userdata *u) {
return;
if (u->sink_filename) {
- if ((f = fopen(u->sink_filename, "w"))) {
+ if ((f = pa_fopen_cloexec(u->sink_filename, "w"))) {
pa_sink *s = pa_namereg_get_default_sink(u->core);
fprintf(f, "%s\n", s ? s->name : "");
fclose(f);
@@ -117,7 +117,7 @@ static void save(struct userdata *u) {
}
if (u->source_filename) {
- if ((f = fopen(u->source_filename, "w"))) {
+ if ((f = pa_fopen_cloexec(u->source_filename, "w"))) {
pa_source *s = pa_namereg_get_default_source(u->core);
fprintf(f, "%s\n", s ? s->name : "");
fclose(f);
diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c
index b1f24e15..1fe8eb8b 100644
--- a/src/modules/module-detect.c
+++ b/src/modules/module-detect.c
@@ -63,7 +63,7 @@ static int detect_alsa(pa_core *c, int just_one) {
FILE *f;
int n = 0, n_sink = 0, n_source = 0;
- if (!(f = fopen("/proc/asound/devices", "r"))) {
+ if (!(f = pa_fopen_cloexec("/proc/asound/devices", "r"))) {
if (errno != ENOENT)
pa_log_error("open(\"/proc/asound/devices\") failed: %s", pa_cstrerror(errno));
@@ -124,9 +124,9 @@ static int detect_oss(pa_core *c, int just_one) {
FILE *f;
int n = 0, b = 0;
- if (!(f = fopen("/dev/sndstat", "r")) &&
- !(f = fopen("/proc/sndstat", "r")) &&
- !(f = fopen("/proc/asound/oss/sndstat", "r"))) {
+ if (!(f = pa_fopen_cloexec("/dev/sndstat", "r")) &&
+ !(f = pa_fopen_cloexec("/proc/sndstat", "r")) &&
+ !(f = pa_fopen_cloexec("/proc/asound/oss/sndstat", "r"))) {
if (errno != ENOENT)
pa_log_error("failed to open OSS sndstat device: %s", pa_cstrerror(errno));
diff --git a/src/modules/module-match.c b/src/modules/module-match.c
index 0bd781d2..b1693f18 100644
--- a/src/modules/module-match.c
+++ b/src/modules/module-match.c
@@ -85,7 +85,7 @@ static int load_rules(struct userdata *u, const char *filename) {
pa_assert(u);
if (filename)
- f = fopen(fn = pa_xstrdup(filename), "r");
+ f = pa_fopen_cloexec(fn = pa_xstrdup(filename), "r");
else
f = pa_open_config_file(DEFAULT_MATCH_TABLE_FILE, DEFAULT_MATCH_TABLE_FILE_USER, NULL, &fn);
diff --git a/src/modules/module-mmkbd-evdev.c b/src/modules/module-mmkbd-evdev.c
index 516bf413..14a9dd3d 100644
--- a/src/modules/module-mmkbd-evdev.c
+++ b/src/modules/module-mmkbd-evdev.c
@@ -175,7 +175,7 @@ int pa__init(pa_module*m) {
u->fd = -1;
u->fd_type = 0;
- if ((u->fd = open(pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), O_RDONLY|O_NOCTTY)) < 0) {
+ if ((u->fd = pa_open_cloexec(pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), O_RDONLY, 0)) < 0) {
pa_log("Failed to open evdev device: %s", pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 9c169327..10cc3415 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -253,12 +253,11 @@ int pa__init(pa_module*m) {
u->filename = pa_runtime_path(pa_modargs_get_value(ma, "file", DEFAULT_FILE_NAME));
mkfifo(u->filename, 0666);
- if ((u->fd = open(u->filename, O_RDWR|O_NOCTTY)) < 0) {
+ if ((u->fd = pa_open_cloexec(u->filename, O_RDWR, 0)) < 0) {
pa_log("open('%s'): %s", u->filename, pa_cstrerror(errno));
goto fail;
}
- pa_make_fd_cloexec(u->fd);
pa_make_fd_nonblock(u->fd);
if (fstat(u->fd, &st) < 0) {
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index 49104f8d..de680933 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -238,12 +238,11 @@ int pa__init(pa_module*m) {
u->filename = pa_runtime_path(pa_modargs_get_value(ma, "file", DEFAULT_FILE_NAME));
mkfifo(u->filename, 0666);
- if ((u->fd = open(u->filename, O_RDWR|O_NOCTTY)) < 0) {
+ if ((u->fd = pa_open_cloexec(u->filename, O_RDWR, 0)) < 0) {
pa_log("open('%s'): %s", u->filename, pa_cstrerror(errno));
goto fail;
}
- pa_make_fd_cloexec(u->fd);
pa_make_fd_nonblock(u->fd);
if (fstat(u->fd, &st) < 0) {
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index b0d4db43..955997ba 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -327,7 +327,7 @@ static int open_audio_device(struct userdata *u, pa_sample_spec *ss) {
pa_assert(u);
pa_assert(ss);
- if ((u->fd = open(u->device_name, u->mode | O_NONBLOCK)) < 0) {
+ if ((u->fd = pa_open_cloexec(u->device_name, u->mode | O_NONBLOCK)) < 0) {
pa_log_warn("open %s failed (%s)", u->device_name, pa_cstrerror(errno));
return -1;
}
diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index 1b1e9c1a..a12f7c93 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -172,7 +172,7 @@ static pa_bool_t is_card_busy(const char *id) {
if (status_file)
fclose(status_file);
- if (!(status_file = fopen(sub_status, "r"))) {
+ if (!(status_file = pa_fopen_cloexec(sub_status, "r"))) {
pa_log_warn("Failed to open %s: %s", sub_status, pa_cstrerror(errno));
continue;
}
diff --git a/src/modules/oss/oss-util.c b/src/modules/oss/oss-util.c
index 5a109ae9..b95023c3 100644
--- a/src/modules/oss/oss-util.c
+++ b/src/modules/oss/oss-util.c
@@ -55,7 +55,7 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) {
pcaps = &caps;
if (*mode == O_RDWR) {
- if ((fd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) >= 0) {
+ if ((fd = pa_open_cloexec(device, O_RDWR|O_NDELAY, 0)) >= 0) {
ioctl(fd, SNDCTL_DSP_SETDUPLEX, 0);
if (ioctl(fd, SNDCTL_DSP_GETCAPS, pcaps) < 0) {
@@ -71,14 +71,14 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) {
pa_close(fd);
}
- if ((fd = open(device, (*mode = O_WRONLY)|O_NDELAY|O_NOCTTY)) < 0) {
- if ((fd = open(device, (*mode = O_RDONLY)|O_NDELAY|O_NOCTTY)) < 0) {
+ if ((fd = pa_open_cloexec(device, (*mode = O_WRONLY)|O_NDELAY, 0)) < 0) {
+ if ((fd = pa_open_cloexec(device, (*mode = O_RDONLY)|O_NDELAY, 0)) < 0) {
pa_log("open('%s'): %s", device, pa_cstrerror(errno));
goto fail;
}
}
} else {
- if ((fd = open(device, *mode|O_NDELAY|O_NOCTTY)) < 0) {
+ if ((fd = pa_open_cloexec(device, *mode|O_NDELAY, 0)) < 0) {
pa_log("open('%s'): %s", device, pa_cstrerror(errno));
goto fail;
}
@@ -145,8 +145,6 @@ success:
pa_log_debug("capabilities:%s", t);
pa_xfree(t);
- pa_make_fd_cloexec(fd);
-
return fd;
fail:
@@ -351,9 +349,9 @@ int pa_oss_get_hw_description(const char *dev, char *name, size_t l) {
if ((n = get_device_number(dev)) < 0)
return -1;
- if (!(f = fopen("/dev/sndstat", "r")) &&
- !(f = fopen("/proc/sndstat", "r")) &&
- !(f = fopen("/proc/asound/oss/sndstat", "r"))) {
+ if (!(f = pa_fopen_cloexec("/dev/sndstat", "r")) &&
+ !(f = pa_fopen_cloexec("/proc/sndstat", "r")) &&
+ !(f = pa_fopen_cloexec("/proc/asound/oss/sndstat", "r"))) {
if (errno != ENOENT)
pa_log_warn("failed to open OSS sndstat device: %s", pa_cstrerror(errno));
@@ -403,7 +401,7 @@ int pa_oss_get_hw_description(const char *dev, char *name, size_t l) {
static int open_mixer(const char *mixer) {
int fd;
- if ((fd = open(mixer, O_RDWR|O_NDELAY|O_NOCTTY)) >= 0)
+ if ((fd = pa_open_cloexec(mixer, O_RDWR|O_NDELAY, 0)) >= 0)
return fd;
return -1;
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 1a05f57d..7dbb1efa 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -390,7 +390,7 @@ static int mcast_socket(const struct sockaddr* sa, socklen_t salen) {
pa_assert(salen > 0);
af = sa->sa_family;
- if ((fd = socket(af, SOCK_DGRAM, 0)) < 0) {
+ if ((fd = pa_socket_cloexec(af, SOCK_DGRAM, 0)) < 0) {
pa_log("Failed to create socket: %s", pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 8e1cfe36..ab815223 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -262,7 +262,7 @@ int pa__init(pa_module*m) {
goto fail;
}
- if ((fd = socket(af, SOCK_DGRAM, 0)) < 0) {
+ if ((fd = pa_socket_cloexec(af, SOCK_DGRAM, 0)) < 0) {
pa_log("socket() failed: %s", pa_cstrerror(errno));
goto fail;
}
@@ -277,7 +277,7 @@ int pa__init(pa_module*m) {
#endif
}
- if ((sap_fd = socket(af, SOCK_DGRAM, 0)) < 0) {
+ if ((sap_fd = pa_socket_cloexec(af, SOCK_DGRAM, 0)) < 0) {
pa_log("socket() failed: %s", pa_cstrerror(errno));
goto fail;
}
@@ -316,8 +316,6 @@ int pa__init(pa_module*m) {
/* If the socket queue is full, let's drop packets */
pa_make_fd_nonblock(fd);
pa_make_udp_socket_low_delay(fd);
- pa_make_fd_cloexec(fd);
- pa_make_fd_cloexec(sap_fd);
pa_source_output_new_data_init(&data);
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_NAME, "RTP Monitor Stream");