summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/authkey.c
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/pulsecore/authkey.c
parent9c1a98953f25aff7f11af80a073c9c46dee2438c (diff)
use cloexec wrappers wherever applicable
Diffstat (limited to 'src/pulsecore/authkey.c')
-rw-r--r--src/pulsecore/authkey.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/pulsecore/authkey.c b/src/pulsecore/authkey.c
index 15613e27..d671e367 100644
--- a/src/pulsecore/authkey.c
+++ b/src/pulsecore/authkey.c
@@ -70,10 +70,6 @@ static int generate(int fd, void *ret_data, size_t length) {
#define O_BINARY 0
#endif
-#ifndef O_NOCTTY
-#define O_NOCTTY 0
-#endif
-
/* Load an euthorization cookie from file fn and store it in data. If
* the cookie file doesn't exist, create it */
static int load(const char *fn, void *data, size_t length) {
@@ -86,9 +82,9 @@ static int load(const char *fn, void *data, size_t length) {
pa_assert(data);
pa_assert(length > 0);
- if ((fd = open(fn, O_RDWR|O_CREAT|O_BINARY|O_NOCTTY, S_IRUSR|S_IWUSR)) < 0) {
+ if ((fd = pa_open_cloexec(fn, O_RDWR|O_CREAT|O_BINARY, S_IRUSR|S_IWUSR)) < 0) {
- if (errno != EACCES || (fd = open(fn, O_RDONLY|O_BINARY|O_NOCTTY)) < 0) {
+ if (errno != EACCES || (fd = open(fn, O_RDONLY|O_BINARY)) < 0) {
pa_log_warn("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno));
goto finish;
} else
@@ -204,7 +200,7 @@ int pa_authkey_save(const char *fn, const void *data, size_t length) {
if (!(p = normalize_path(fn)))
return -2;
- if ((fd = open(p, O_RDWR|O_CREAT|O_NOCTTY, S_IRUSR|S_IWUSR)) < 0) {
+ if ((fd = pa_open_cloexec(p, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0) {
pa_log_warn("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno));
goto finish;
}