summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-10-30 03:32:38 +0100
committerLennart Poettering <lennart@poettering.net>2009-10-30 03:32:38 +0100
commit65e7bc18a9a7b89e55b87a74ae47d45269b51847 (patch)
treeb9f58d76a78ecc0c03557bf7a7dad14cf28e15f9 /src/modules
parent9c1a98953f25aff7f11af80a073c9c46dee2438c (diff)
use cloexec wrappers wherever applicable
Diffstat (limited to 'src/modules')
-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/oss/oss-util.c12
-rw-r--r--src/modules/rtp/module-rtp-recv.c2
-rw-r--r--src/modules/rtp/module-rtp-send.c6
7 files changed, 12 insertions, 18 deletions
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/oss/oss-util.c b/src/modules/oss/oss-util.c
index 5a109ae9..41af3bac 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:
@@ -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");